Title: Undefined array key &#8220;public&#8221;
Last modified: March 2, 2025

---

# Undefined array key “public”

 *  Resolved [peter8nss](https://wordpress.org/support/users/peter8nss/)
 * (@peter8nss)
 * [1 year, 3 months ago](https://wordpress.org/support/topic/undefined-array-key-public/)
 * I’m getting the following in my system log when I edit my content control settings.
 *     ```wp-block-code
       PHP Warning:  Undefined array key "public" in .../wp-content/plugins/content-control/classes/Controllers/RestAPI.php on line 88'
       ```
   
 * I think the problem originates from a plugin I have recently installed which 
   registers a taxonomy without specifying a value for “public” in the $args. Checking
   the WordPress code I can see that the defaults are not set in WP_Taxonomy::set_props
   until after the register_taxonomy_args filter call. Therefore, RestAPI::modify_type_force_show_in_rest
   should not assume that $args[‘public’] exists. Specifically, the if statement
   at line 88 should include an isset condition first (as it already does for the“
   show_in_rest” value of $args in the previous if).

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

 *  Plugin Author [Daniel Iser](https://wordpress.org/support/users/danieliser/)
 * (@danieliser)
 * [1 year, 3 months ago](https://wordpress.org/support/topic/undefined-array-key-public/#post-18356535)
 * Just changed it to
 *     ```wp-block-code
       		$is_public = isset( $args['public'] ) && $args['public'];		// Check if this is a private taxonomy.		if ( ! $is_public ) {			if ( $include_private ) {				$args['show_in_rest'] = true; // Enable REST API.			}		} else {			$args['show_in_rest'] = true; // Enable REST API.		}
       ```
   
 *  Thread Starter [peter8nss](https://wordpress.org/support/users/peter8nss/)
 * (@peter8nss)
 * [1 year, 3 months ago](https://wordpress.org/support/topic/undefined-array-key-public/#post-18356602)
 * That clears the error message I was getting.

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

The topic ‘Undefined array key “public”’ is closed to new replies.

 * ![](https://ps.w.org/content-control/assets/icon-256x256.gif?rev=2968535)
 * [Content Control - The Ultimate Content Restriction Plugin! Restrict Content, Create Conditional Blocks & More](https://wordpress.org/plugins/content-control/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/content-control/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/content-control/)
 * [Active Topics](https://wordpress.org/support/plugin/content-control/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/content-control/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/content-control/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [peter8nss](https://wordpress.org/support/users/peter8nss/)
 * Last activity: [1 year, 3 months ago](https://wordpress.org/support/topic/undefined-array-key-public/#post-18356602)
 * Status: resolved