Ecommerce Shopify WordPress Discussion

data missing on transition_post_status

I am developing a wordpress plugin make a filter with data from a new post and old post. If the post is publish the trigger have to read the meta and the feature image of the post. If the post already exist and the post is change from the draft to publish I can have the data. Is not the case when the post is new, I have the id but the data stay empty. function getDataFromPost($new_status, $old_status, $post) { if ($new_status === 'publish' && $old_status !== 'publish' && $post->post_type === 'rv-products') { $data=[]; $data['id_unit']=$post->ID; $data['title']=$post->post_title; $data['url']=$post->guid; $data['rv-manufacturer-brand']=get_concatenated_terms( $post->ID, 'rv-manufacturer-brand' );#multiple $data['rv-types']=get_concatenated_terms2( $post->ID, 'rv-types' ); #multiple $data['fuel-type']=remove_string_from_another(get_post_meta($post->ID, 'fuel-type', true),'fuel-'); $data['condition']=remove_string_from_another(get_post_meta($post->ID, 'condition', true),'va-'); $data['sleeps']=remove_string_from_another(get_post_meta($post->ID, 'sleeps', true),'sleeps-'); #min $data['regular-price']=get_post_meta($post->ID, 'regular-price', true); #max $data['years']=get_post_meta($post->ID, 'years', true); #min $data['odometer']=get_post_meta($post->ID, 'odometer', true); #max $data['weight']=get_post_meta($post->ID, 'weight', true); #max $data['lenght']=get_post_meta($post->ID, 'lenght', true); #max $data['FeatureImage']=get_the_post_thumbnail_url($post->ID, 'full'); #$thumbnail_id = get_post_thumbnail_id($post->ID); #$full_image = wp_get_attachment_image_src($thumbnail_id, 'full'); #$data['FeatureImage'] = $full_image[0]; $data['logo']=wp_get_attachment_image_url( get_theme_mod( 'custom_logo' ), 'full' ); $data['cie'] = get_bloginfo('name'); printf($data) } } add_action('getDataFromPost', 'getDataFromPost', 100, 3);
TurboCommerce make the better internet purchasing globaly

Turbo Multi-language Translator

Make the better internet purchasing globaly

Turbosify SEO Speed Booster

5.0 (7) Free plan available
Get better conversions by improving store loading speed Installed

Turbo Multi-language Chat - AI Customer service in one hand

TurboCommerce make the better internet purchasing globaly
Our products

The help you need, when you need it

App by Turbo Engine

3 apps • 5.0 average rating

Turbosify Speed Booster

5.0 (7)
Get better conversions by optimizing shopify store Google page speed Installed

Turbosify Translator for Wordpress Woocommerce

5.0 (74) Free Wordpress Woocommerce Plugin
Translate your wordpress website to multiple language within 1 click, no configuration needed, no No technical required

Grow your business here

Whether you want to sell products down the street or around the world, we have all the tools you need.