How to remove the “+Add Category” button from the Category metabox?

I installed the ‘User Role Editor’ plugin and removed the ‘manage_categories’ capability for the ‘Editor’ which worked. But I would like to remove it for ALL users including admin, superadmin. If removing the ‘manage_categories’ capability from the editor role provides the functionality you want, then you can remove the ‘manage_categories’ capability from all user roles … Read more

PHP Fatal error: Cannot use object of type WP_REST_Response as array in wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php

Nobody pointed out I was using ‘$data’ incorrectly. function dept_cat_api( $request ) { $args = array( ‘post_type’ => ‘post’, ‘tax_query’ => array( ‘relation’ => ‘AND’, array( ‘taxonomy’ => ‘crosspost’, ‘field’ => ‘slug’, ‘terms’ => array( $request[‘dept’] ), ), array( ‘taxonomy’ => ‘category’, ‘field’ => ‘slug’, ‘terms’ => array( $request[‘cat’] ), ), ), ); $posts = … Read more

Getting categories id for all products in cart

Use $cart_item[‘data’]->get_category_ids() to retrieve the category IDs: $category_ids = $cart_item[‘data’]->get_category_ids(); // array The category_ids you see is not a direct item in the $cart_item array: var_dump( $cart_item[‘category_ids’] ); // null and PHP throws a notice It’s an item in a protected property of the product data ($cart_item[‘data’]) which is an object, or a class instance … Read more

How to not treat categories as tags in feeds

Tricky. It lumps categories and tags together pretty good. Had couple of approaches here is least messy: add_filter(‘the_category_rss’, ‘remove_rss_categories’); function remove_rss_categories( $the_list ) { $categories = get_the_category(); foreach ($categories as $category) $the_list = str_replace(“<category><![CDATA[{$category->name}]]></category>”, ”, $the_list); return $the_list; }