The-seo-framework: Guttenberg Taxonomy Error

Created on 16 Jul 2020  路  5Comments  路  Source: sybrew/the-seo-framework

Describe the bug

How to reproduce the bug
Steps to reproduce the behavior:

  1. Go to custom post type
  2. Click on multiple custom taxonomy
  3. See error

Expected behavior

Screenshots
IMG 2020-07-16 胁 15 17 17

Additional context
bucketSort@[native code]
stringSort@[native code]
sort@[native code]
getSelectOptions@https://site.loc/wp-content/plugins/autodescription/lib/js/pt-gb.js?ver=4.0.7:251:55
render@https://site.loc/wp-content/plugins/autodescription/lib/js/pt-gb.js?ver=4.0.7:277:63
finishClassComponent@https://c0.wp.com/c/5.4.2/wp-includes/js/dist/vendor/react-dom.js:17177:37
updateClassComponent@https://c0.wp.com/c/5.4.2/wp-includes/js/dist/vendor/react-dom.js:17132:44
callCallback@https://c0.wp.com/c/5.4.2/wp-includes/js/dist/vendor/react-dom.js:341:19
dispatchEvent@[native code]
invokeGuardedCallbackDev@https://c0.wp.com/c/5.4.2/wp-includes/js/dist/vendor/react-dom.js:391:29
invokeGuardedCallback@https://c0.wp.com/c/5.4.2/wp-includes/js/dist/vendor/react-dom.js:448:36
beginWork$$1@https://c0.wp.com/c/5.4.2/wp-includes/js/dist/vendor/react-dom.js:23355:28
performUnitOfWork@https://c0.wp.com/c/5.4.2/wp-includes/js/dist/vendor/react-dom.js:22349:24
workLoopSync@https://c0.wp.com/c/5.4.2/wp-includes/js/dist/vendor/react-dom.js:22323:39
renderRoot@https://c0.wp.com/c/5.4.2/wp-includes/js/dist/vendor/react-dom.js:22016:23
renderRoot@[native code]
runRootCallback@https://c0.wp.com/c/5.4.2/wp-includes/js/dist/vendor/react-dom.js:21692:28
runRootCallback@[native code]
https://c0.wp.com/c/5.4.2/wp-includes/js/dist/vendor/react-dom.js:11491:32
unstable_runWithPriority@https://c0.wp.com/c/5.4.2/wp-includes/js/dist/vendor/react.js:2820:24
flushSyncCallbackQueueImpl@https://c0.wp.com/c/5.4.2/wp-includes/js/dist/vendor/react-dom.js:11487:24
flushSyncCallbackQueue@https://c0.wp.com/c/5.4.2/wp-includes/js/dist/vendor/react-dom.js:11476:29
discreteUpdates$1@https://c0.wp.com/c/5.4.2/wp-includes/js/dist/vendor/react-dom.js:21815:29
discreteUpdates@https://c0.wp.com/c/5.4.2/wp-includes/js/dist/vendor/react-dom.js:2357:31
dispatchDiscreteEvent@https://c0.wp.com/c/5.4.2/wp-includes/js/dist/vendor/react-dom.js:6104:18
dispatchDiscreteEvent@[native code]

when the plugin is turned off, everything works without errors

P.S.

very strange, this problem is not observed on the production server, only on localhost, which runs on laravel valet ...

[Component] JES5 [Status] Feedback required [Type] Bug

All 5 comments

This probably happens when no terms are (automatically) selected or registered. Where, otherwise, your live server should have some.

Thanks for the report, I'll investigate!

Hi @9585999,

Unfortunately, I'm unable to replicate the issue.

Could you post a screenshot of the "multiple custom taxonomy" interface?
And perhaps, also, share the parameters you used to create the post type and its taxonomies?

Thank you!

Hi @sybrew,

ezgif-2-2a1c179d07ce

Post Type:

/**
 * Registers the `faq` post type.
 */
function faq_init() {
    register_post_type( 'faq', array(
        'labels'                => array(
            'name'                  => __( 'Faqs', 'site' ),
            'singular_name'         => __( 'Faq', 'site' ),
            'all_items'             => __( 'All Faqs', 'site' ),
            'archives'              => __( 'Faq Archives', 'site' ),
            'attributes'            => __( 'Faq Attributes', 'site' ),
            'insert_into_item'      => __( 'Insert into faq', 'site' ),
            'uploaded_to_this_item' => __( 'Uploaded to this faq', 'site' ),
            'featured_image'        => _x( 'Featured Image', 'faq', 'site' ),
            'set_featured_image'    => _x( 'Set featured image', 'faq', 'site' ),
            'remove_featured_image' => _x( 'Remove featured image', 'faq', 'site' ),
            'use_featured_image'    => _x( 'Use as featured image', 'faq', 'site' ),
            'filter_items_list'     => __( 'Filter faqs list', 'site' ),
            'items_list_navigation' => __( 'Faqs list navigation', 'site' ),
            'items_list'            => __( 'Faqs list', 'site' ),
            'new_item'              => __( 'New Faq', 'site' ),
            'add_new'               => __( 'Add New', 'site' ),
            'add_new_item'          => __( 'Add New Faq', 'site' ),
            'edit_item'             => __( 'Edit Faq', 'site' ),
            'view_item'             => __( 'View Faq', 'site' ),
            'view_items'            => __( 'View Faqs', 'site' ),
            'search_items'          => __( 'Search faqs', 'site' ),
            'not_found'             => __( 'No faqs found', 'site' ),
            'not_found_in_trash'    => __( 'No faqs found in trash', 'site' ),
            'parent_item_colon'     => __( 'Parent Faq:', 'site' ),
            'menu_name'             => __( 'Faqs', 'site' ),
        ),
        'public'                => true,
        'hierarchical'          => false,
        'show_ui'               => true,
        'show_in_nav_menus'     => true,
        'supports'              => array( 'title', 'editor', 'excerpt', 'comments' ),
        'has_archive'           => false,
        'rewrite'               => array(
            'slug' => 'faq',
            'with_front' => false,
        ),
        'query_var'             => true,
        'menu_position'         => null,
        'menu_icon'             => 'dashicons-editor-help',
        'show_in_rest'          => true,
        'rest_base'             => 'faq',
        'rest_controller_class' => 'WP_REST_Posts_Controller',
    ) );

}
add_action( 'init', 'faq_init' );

Taxonomy:

/**
 * Registers the `faq_cat` taxonomy,
 * for use with 'faq'.
 */
function faq_cat_init() {
    register_taxonomy( 'faq_cat', array( 'faq' ), array(
        'hierarchical'      => true,
        'public'            => true,
        'show_in_nav_menus' => true,
        'show_ui'           => true,
        'show_admin_column' => false,
        'query_var'         => true,
        'show_admin_column' => true,
        'rewrite'           => array(
            'slug' => 'faq-category',
            'with_front' => false,
        ),
        'capabilities'      => array(
            'manage_terms'  => 'edit_posts',
            'edit_terms'    => 'edit_posts',
            'delete_terms'  => 'edit_posts',
            'assign_terms'  => 'edit_posts',
        ),
        'labels'            => array(
            'name'                       => __( 'Faq categories', 'site' ),
            'singular_name'              => _x( 'Faq category', 'taxonomy general name', 'site' ),
            'search_items'               => __( 'Search Faq categories', 'site' ),
            'popular_items'              => __( 'Popular Faq categories', 'site' ),
            'all_items'                  => __( 'All Faq categories', 'site' ),
            'parent_item'                => __( 'Parent Faq category', 'site' ),
            'parent_item_colon'          => __( 'Parent Faq category:', 'site' ),
            'edit_item'                  => __( 'Edit Faq category', 'site' ),
            'update_item'                => __( 'Update Faq category', 'site' ),
            'view_item'                  => __( 'View Faq category', 'site' ),
            'add_new_item'               => __( 'Add New Faq category', 'site' ),
            'new_item_name'              => __( 'New Faq category', 'site' ),
            'separate_items_with_commas' => __( 'Separate faq categories with commas', 'site' ),
            'add_or_remove_items'        => __( 'Add or remove faq categories', 'site' ),
            'choose_from_most_used'      => __( 'Choose from the most used faq categories', 'site' ),
            'not_found'                  => __( 'No faq categories found.', 'site' ),
            'no_terms'                   => __( 'No faq categories', 'site' ),
            'menu_name'                  => __( 'Faq categories', 'site' ),
            'items_list_navigation'      => __( 'Faq categories list navigation', 'site' ),
            'items_list'                 => __( 'Faq categories list', 'site' ),
            'most_used'                  => _x( 'Most Used', 'faq_cat', 'site' ),
            'back_to_items'              => __( '← Back to Faq categories', 'site' ),
        ),
        'show_in_rest'      => true,
        'rest_base'         => 'faq_cat',
        'rest_controller_class' => WP_REST_Terms_Controller::class,
    ) );
}
add_action( 'init', 'faq_cat_init' );

Config:

/*
 |--------------------------------------------------------------------------
 | WordPress Debug
 |--------------------------------------------------------------------------
 */
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'SAVEQUERIES', WP_DEBUG );
define( 'WP_DEBUG_DISPLAY', WP_DEBUG );
define( 'SCRIPT_DEBUG', WP_DEBUG );
define( 'JETPACK_DEV_DEBUG', WP_DEBUG );
define( 'QM_DISABLED', ! WP_DEBUG );

/*
 |--------------------------------------------------------------------------
 | WordPress General
 |--------------------------------------------------------------------------
 */
define( 'EMPTY_TRASH_DAYS', 7 );
define( 'AUTOSAVE_INTERVAL', 86400 );
define( 'DISALLOW_FILE_EDIT', false );
define( 'DISALLOW_FILE_MODS', false );
define( 'DISALLOW_UNFILTERED_HTML', true );
define( 'FORCE_SSL_ADMIN', false );
define( 'WP_ALLOW_REPAIR', true );
define( 'WP_AUTO_UPDATE_CORE', true );
define( 'WP_POST_REVISIONS', false );

/*
 |--------------------------------------------------------------------------
 | WordPress Memory
 |--------------------------------------------------------------------------
 */
define( 'WP_MAX_MEMORY_LIMIT' , '512M' );
define( 'WP_MEMORY_LIMIT' , '512M' );

/*
 |--------------------------------------------------------------------------
 | WordPress Cron
 |--------------------------------------------------------------------------
 */
define( 'ALTERNATE_WP_CRON', false );
define( 'DISABLE_WP_CRON', ALTERNATE_WP_CRON );

/*
 |--------------------------------------------------------------------------
 | Contact Form 7
 |--------------------------------------------------------------------------
 */
define ('WPCF7_AUTOP', false );

With WP_DEBUG = false, everything works as expected, but if true, the bug is saved ...

Thank you, @9585999!

The previous primary-term handler was written within 3 days, because... well, WP v5.0 was announced 3 days before its actual release. Thanks, Matt 馃槃 .

In any case, I couldn't replicate this issue even with your post type and taxonomy. I'm not sure what's going on, but I was able to invoke the error via some code wrangling and worked my way around it. At the same time, I improved its performance and intrinsic logic. All should be well henceforth.

Nevertheless, because of this uncertainty, could you test the updated file out for me?
You can find its contents here: https://raw.githubusercontent.com/sybrew/the-seo-framework/54e945999e3cd5abf2572624cd0db607a7b50cfc/lib/js/pt-gb.js.

On your server, the file's located at /wp-content/plugins/autodescription/lib/js/pt-gb.js, and it should work as-is with TSF 4.0.7.

TSF v4.1.0 will be released right before or alongside WP v5.5, which is due in two weeks from now.

@sybrew Nice Work.

I checked the new file, everything works as expected, no more error.

Thank you for your help.

Was this page helpful?
0 / 5 - 0 ratings