1

I use this code to match

current default post title slugs with category term slugs

if ( is_singular( 'post' ) ) {

$current_post_slug = get_post_field( 'post_name' );
        $args['category_name'] = $current_post_slug;
        $args['post_type'] = 'post';

But I want to match current default post title slugs with post type custom taxonomy term slugs. My custom taxonomy name is "itemscategory", my custom post type name is "items".

So I changed the code into

if ( is_singular( 'post' ) ) {

$current_post_slug = get_post_field( 'post_name' );
'tax_query' => array(
    array(
        'taxonomy' => 'itemscategory',

    )
),
        $args['category_name'] = $current_post_slug;
        $args['post_type'] = 'items';

But it doesn't work. What am I doing wrong?

JimDixon
  • 11
  • 1

0 Answers0