Relationships - WP_query - Editing Error

Support MB Relationships Relationships - WP_query - Editing Error

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #30487
    Prabakaran ShankarPrabakaran Shankar
    Participant

    Hello,

    I have pasted below the php code used to display the relationship query. It results in the as expected. However, while editing the post (connected from) results in the error.
    The error is the post-editing the connected post (from the relationships) instead of the current post.
    Hope you understand!

    add_shortcode( 'jobs-scholarship', function() {
        ob_start();
        global $post; // data from the current post in the WP loop
        $categories = get_the_terms( $post->ID, 'current-status' );
        foreach( $categories as $category ) {
        $args=array(
        'post_type' => 'job',
        'post_status' => 'publish',
        'nopaging' => true,
        //  'posts_per_page' => 20,
        'orderby' => array('modified'=>'DESC'),
            'relationship' => [
            'id' => 'scholarships-to-jobs',
            'from' => get_the_ID(),
        ],
            'tax_query' => array(
               'taxonomy' => 'current-status',
                'field'    => 'slug',
                'terms'    => $category->slug,
                ),
        'cache_results' => false
    );}
    $query_jobs_scholarships = new WP_query( $args );
        echo "<h3>{$query_jobs_scholarships->found_posts} Fellowships/Scholarships Open to Apply </h3>";
        if( $query_jobs_scholarships->have_posts() ) {
            echo '
    
    <ol>';
        while( $query_jobs_scholarships->have_posts() ) {
          $query_jobs_scholarships->the_post();
    ?>
      <li><a>" target="_blank">
      <?php the_title(); ?>
          </a></li>
    <?php
    }echo '</ol>
    
    ';
    }else echo 'Sorry, No Fellowships/Scholarships are open at this moment';
    wp_reset_postdata();
    return ob_get_clean();
    }
     );
    #30494
    Long NguyenLong Nguyen
    Moderator

    Hi,

    Can you please share the code that creates the relationship scholarships-to-jobs? And some screenshots or the debug log of the error?

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.