Skip to content

Check if rewrite is an array#753

Open
ajaydsouza wants to merge 1 commit intosybrew:masterfrom
ajaydsouza:patch-1
Open

Check if rewrite is an array#753
ajaydsouza wants to merge 1 commit intosybrew:masterfrom
ajaydsouza:patch-1

Conversation

@ajaydsouza
Copy link
Copy Markdown

$memo['is_taxonomy_hierarchical'] ??= $memo['tax_object']->hierarchical && $memo['tax_object']->rewrite['hierarchical'];

I've registered a hierarchical taxonomy with the rewrite off for my Knowledge Base plugin. Because 'rewrite' is false, I'm getting the above error.

    wp-content/plugins/autodescription/inc/classes/admin/settings/listedit.class.php:574
    The_SEO_Framework\A\S\ListEdit->output_column_contents_for_term()
    wp-includes/class-wp-hook.php:341
    apply_filters('manage_wzkb_category_custom_column')
    wp-admin/includes/class-wp-terms-list-table.php:669
    WP_Terms_List_Table->column_default()
    wp-admin/includes/class-wp-list-table.php:1801
    WP_List_Table->single_row_columns()
    wp-admin/includes/class-wp-terms-list-table.php:352
    WP_Terms_List_Table->single_row()
    wp-admin/includes/class-wp-terms-list-table.php:319
    WP_Terms_List_Table->_rows()
    wp-admin/includes/class-wp-terms-list-table.php:256
    WP_Terms_List_Table->display_rows_or_placeholder()
    wp-admin/includes/class-wp-list-table.php:1635
    WP_List_Table->display()
    wp-admin/edit-tags.php:622

$memo['tax_object'] ??= \get_taxonomy( $taxonomy );
$memo['permastruct'] ??= Meta\URI\Utils::get_url_permastruct( $generator_args );
$memo['is_taxonomy_hierarchical'] ??= $memo['tax_object']->hierarchical && $memo['tax_object']->rewrite['hierarchical'];
$memo['is_taxonomy_hierarchical'] ??= $memo['tax_object']?->hierarchical && is_array( $memo['tax_object']->rewrite ) && $memo['tax_object']->rewrite['hierarchical'];
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The null-safe operator is PHP 8.0+ — TSF still supports 7.4, and roughly 8% of active users are still on that version (data obtained via Troy).

@sybrew
Copy link
Copy Markdown
Owner

sybrew commented Feb 1, 2026

Thanks for the PR! I still need to test this on my end and see if we're overlooking anything else.

@ajaydsouza
Copy link
Copy Markdown
Author

Sounds good. Let me know if you need anything else from me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants