• Hi Rachel,

    I’m using your plugin on site I’m building and while it’s been smooth sailing for most part, I’m struggling to re-implement the associated posts that I had working before.

    Here is a simplified version of the markup I’m working with:

    function liquasil_output_projects () {
    
        global $post;
        
        $projects = get_posts( array(
            'numberposts' => -1,
            'post_type' => 'project',
            'tax_query' => array(
                array(
                    'taxonomy' => 'project_installer',
                    'field'    => 'slug',
                    'terms'    => wp_get_object_terms( get_the_ID(), 'project_installer', array( 'fields' => 'slug' ) ),
                )
            ),
            'suppress_filters' => false
        ) );
    
        if( $projects ) :
            foreach ( $projects as $project ) :
                echo $post->post_title;
            endforeach;
        endif;
    
        wp_reset_query();
    
    }
    add_action( 'beans_post_prepend_markup', 'liquasil_output_projects');

    When I print out the projects array it says it’s an invalid taxonomy, but looking in the db I can see it exists.

    Any idea what I’m doing wrong?

    TIA!

    Chris

  • The topic ‘Associated posts using cpt-onomies post/taxonomy’ is closed to new replies.