WP_Query Check if post has one or more attached medias

I’m afraid that it’s not possible by default. Using WP_Query you can only check if posts have a featured image set. What you can do instead: Create a hook that fires during post save (e.g. “post_updated”), check if this post has any attachments – save this information in post_meta. Use meta_query with WP_Query to get …

Read more

Ajax call not working

I have updated the code in your shared code. Please ask in the comments if you did not get changes. add_action(‘wp_ajax_dynamic_price’, ‘get_update_dynamic_price_xyz’); add_action(‘wp_ajax_nopriv_dynamic_price’, ‘get_update_dynamic_price_xyz’); function get_update_dynamic_price_xyz() { global $product; /** * Get the discount details of given product with custom price * @param $price float/integer * @param $product object (Product object Example: wc_get_product($product_id)) * @param …

Read more