Displaying a post correctly after wp_update_post
-
I have a custom post type which occasionally needs to be updated using information from an external source.
As of right now, I have a function that does the work properly but it requires that the post be re-loaded in order for the correct data to be displayed.
This is accomplished using some php I’ve added to my single.php file right before the Loop.
simplified example:
<?php if(function_exists('price_updater')) { price_updater(); } ?>
‘price_updater’ uses ‘wp_update_post’ to update the content and a meta_field. These definitely get updated but I get the previous version on the first pass. If I hit the reload page it shows the updated version.
So the question is, how do I set this up to avoid refreshing the page?
I’m guessing using ‘add_action’ or ‘add_filter’ but I’ve had no success so far – the handful I’ve tried either have the same problem or do nothing.
- The topic ‘Displaying a post correctly after wp_update_post’ is closed to new replies.