How to filter by category name in custom post types?

Looking at the official wordpress documetation for WP_Query category https://developer.wordpress.org/reference/classes/wp_query/#category-parameters It should be something like $args = array( ‘post_type’ => ‘fruits’, ‘posts_per_page’ => 4, ‘category_name’ => ‘apple’ // category_name instead of category ); $query = new WP_Query( $args ); This is assuming you actually use the category and not custom taxonomy Also if actually refer … Read more

Custom nav walker: How to acces the $args parameter?

WordPress Walkers aren’t using constructors. They are started up with walk() method which is passed arguments as third argument (confusingly not reflected in method signature). You can capture it into your object’s property with something like this: class Args_Walker extends Walker { public function walk( $elements, $max_depth ) { // we could declare above, but … Read more