At the moment you publish/update the post with recommended price
, it’s better to have another custom meta post to save the real price
in it by using add_action() and add_post_meta(), then you can use the query you posted but with $query_args['meta_key'] = 'real_price';
Something like below:
function wp_po54785( $post_id )
{
$recommended_price = get_post_meta( $post_id, 'price', true );
if ( ! $recommended_price )
return;
// Avoid infinite loops
remove_action( current_filter(), __FUNCTION__ );
// If you're doing this from inside a class:
# remove_action( current_filter(), array( $this, __FUNCTION__ ) );
// The Algorithm
// You use to
// Calculate real price
// By doing works on $recommended_price
// And put in $real_price;
add_post_meta( $post_id, 'real_price', $real_price );
}
add_action( 'save_post', 'wp_po54785' );
Related Posts:
- How can I custom order the results from wp_list_categories?
- Sorting Woocommerce products with numeric titles [closed]
- How to order posts by meta_value created inside loop?
- How to get_posts where ‘menu_order’ is more than 0/zero?
- How to check if a product is purchased within the last 365 days before displaying something
- Ascending order has strange effects on wordpress loop
- Loop order issue with Ajax filter
- Loop random posts and display odd and even based on two alternating meta values?
- WordPress redundant posts based on meta field
- WordPress Not Sorting By Custom Field
- How to use orderby on meta_value when using Pods custom database table storage
- Counting the posts of a custom WordPress loop (WP_Query)?
- Get post content from outside the loop
- Is it necessary to reset the query after using get_posts()?
- Is there any difference between the_title() and echo get_the_title()?
- Pagination not working on home page
- How to Change Loop to Order Posts by Views (using wp-postviews plugin)
- Get ID of a page containing secondary loop in content
- is_home, and is_front_page conditional problem
- Is `query_posts` really slower than secondary query?
- Are there any scenarios where the query_posts may be used?
- Display subpages under parent page as a list within a loop
- When to use wp_reset_postdata();
- Exclude category by slug for for each loop
- Related Posts loop – offset
- WordPress Loop Through Particular Pages
- Showing current subcategory
- Display date only once for a each set of posts relating to that date
- The main Loop is not starting in a custom blog template page
- Generating dynamic Tabs with multiple query post loop
- How do I override part of the main loop in my child theme?
- connect last post with first post
- Chopping up a large ajax request of around 200 posts [closed]
- Combining the_excerpt with the_content
- Better way to display posts from specific categories, in a grid layout
- Infinite Redirect Loop after moving to subdirectory
- WordPress Loop – Not returning projects in specific category
- Next and Previous loop
- Query reset problem or flawed code to enable custom post type query
- Exclude posts from main loop based on meta value
- Using an ACF field from a page within a post loop?
- WooCommerce – How to show specific category first-rest of products-specific category last
- trouble calling an import class from an action in a plugin before wp_cron executes
- Blog page Server error 500 with stick post loop in query.php
- How can I paginate this?
- Obtain page data and use regular loop
- How can I load posts starting from, and including, the current post?
- How to fix pagination for custom loops?
- Show all posts using the template page and the loop?
- ‘Auto Draft’ Post showing in wordpress loop
- How do I display an image before the first post of the loop when I’m using get_template_part?
- Multiple get_posts() queries on one page
- 4 column-loop ordered alphabetically with entries grouped (and labeled) by their first letter
- Change date format
- Custom loop not working
- Loop inside query
- In Custom page – next_posts_link Not working while previous_posts_link is working
- Escape current post from loop
- Why isn’t my multiple loops working?
- How can I display other user avatars on an author profile page?
- something strange is happening to my code
- How do I display the latest posts from three different categories?
- facebook like, tweet and google+1 buttons inside the loop on home, archive and search pages and missing facebook like buttons
- Loop Offset for tag based “Related Posts”
- How do I put my frontpage featured image in a page template for home.php?
- Randomly display post based on meta value. (Kind of Priority/Weight)
- How to print redux gallery feilds id? [closed]
- Why the first with flexslider appears as blank on my code?
- Rendering pages
- How can have a conditional template tag based on the main loop within a secondary loop with new WP_Query(), using get_template_part()
- WP_Query is only looping home page, not pages
- How to filter posts by category INSIDE the loop
- static page with multiple loops breaks post pagination
- new custom theme – posts displaying on top of one another
- Help with if and else statement
- Custom Header added within Dashboard pages, is this possible with custom template files?
- Adding a second loop breaks everything
- Custom Query with Sticky Posts
- is it bad to copy the loop for a template?
- I want to load post in bootstrap Modal dynamically
- Why my loop is repeat?
- Return only one post format in index.php [duplicate]
- How to display just video post format?
- Is it possible to get a post ID of a 2 different custom post types loop embedded in the same post to perform update_post_meta from the frontend?
- How to execute custom loop before loop content?
- Sorting posts to make those with post thumbnail show up first
- Best way to check if a post with specific meta exists
- Limit article to 100 characters. Can’t use the_excerpt…
- Return only content in excerpt field in loop
- Default Template infinite loop of Title
- This webpage has a redirect loop issue with SSL page
- Buddypress Group Activity Loop Filter activity type [closed]
- get_posts and wp_autop (remove filter)
- Trouble preventing duplicate posts between 2 loops on homepage
- Create custom post order (with custom post type meta)
- $do_not_duplicate is not working in genesis theme
- Loop displays current page
- Error in Wordprewss loop for page template [closed]
- Tags outside the loop
- Hook in the loop after the first post