Support

Account

Home Forums General Issues what value of post_object should i type for getting all posts with this value?

Solved

what value of post_object should i type for getting all posts with this value?

  • Hey guys!
    I got project with watch categories and watch pages . So i want to use post_object to select my registered categories from ‘post-type’ to show for example only men watches in men watches categories etc.

    I can’t understand why i cant show my posts with value of category what i choose at post page

    $args = array(
                'numberposts'	=> -1,
                'post_type'		=> 'watch-page',
                'order' => 'ASC',
                'meta_query'	=> array(
                  array(
                    'key'		=> 'category_to_select',
                    'value' => $cat, // actually i dont know what should i type here to show my posts
                    'compare' => '!='
                  ),
                )
              );
    
              // query
              $the_query = new WP_Query( $args );

    Please tell me what am i doing wrong.
    at this point i got only posts where no categories selected. That all what i did, but i need to do another task.

  • Done! I just need to create taxonomy ‘categories_tax’ for my watch-page post_type

Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘what value of post_object should i type for getting all posts with this value?’ is closed to new replies.