• Resolved peter8nss

    (@peter8nss)


    I’m getting the following in my system log when I edit my content control settings.

    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

    (@danieliser)

    Just changed it to

    		$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

    (@peter8nss)

    That clears the error message I was getting.

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.