• Resolved agentkiller007

    (@agentkiller007)


    I am using shortcode
    <?php echo do_shortcode('[site_reviews_form assign_to="post_id" schema=true hide="title,name,email" category='.$userTerm.']'); ?>

    issue is – sometimes reviews are getting assigned to another post type that is – (questions) which are present on the same post, to which i have to assign reviews instead what i want is – reviews should only be assigned to post type->business.

    Pls help…

      My Novice thinking

    – what if we place a condition on assign_to="post_id" that it should always be equal to post type – business.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Gemini Labs

    (@geminilabs)

    assign_to=post_id uses the ID of the global $post object, so if the reviews are being assigned to the wrong post, then you need to have a look at how you are querying your posts and make sure that you are resetting the loop correctly after each query.

    For example:

    $the_query = new WP_Query($args);
     
    if ($the_query->have_posts()) {
        while ($the_query->have_posts()) {
    
            // 1. Change the global $post object
            $the_query->the_post();
    
            // 2. Use the shortcode
            echo do_shortcode('[site_reviews_form assign_to=post_id]');
        }
    }
    
    // 3. Restore the original post data
    wp_reset_postdata();
    
    Thread Starter agentkiller007

    (@agentkiller007)

    Thanks alot again that worked…

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Assign Reviews only to specific post type’ is closed to new replies.