• Resolved nebrekab

    (@nebrekab)


    Hi,

    Thanks for the great plugin.

    I have just noticed an issue and was hoping you may be able to shed some light on it… When enabling the Block Editor on a Custom Post Type and pressing update (simply publishing a standard page, no password) I get this error:

    The editor has encountered an unexpected error.
    
    Attempt Recovery
    Copy Post Text
    Copy Error

    The copy error option gives:

    Error: An error occurred while running 'mapSelect': Cannot read property 'protect_children' of undefined
    The error may be correlated with this previous error:
    TypeError: Cannot read property 'protect_children' of undefined
        at https://example.local/wp-content/plugins/protect-the-children/build/index.js?ver=5.7.1:1:958
        at Object.current (https://example.local/wp-includes/js/dist/data.min.js?ver=943087ae96d075f126df689839bb96b9:2:31396)
        at https://example.local/wp-includes/js/dist/data.min.js?ver=943087ae96d075f126df689839bb96b9:2:30908
        at s (https://example.local/wp-includes/js/dist/data.min.js?ver=943087ae96d075f126df689839bb96b9:2:25154)
        at Object.__experimentalMarkListeningStores (https://example.local/wp-includes/js/dist/data.min.js?ver=943087ae96d075f126df689839bb96b9:2:25561)
        at https://example.local/wp-includes/js/dist/data.min.js?ver=943087ae96d075f126df689839bb96b9:2:30208
        at e (https://example.local/wp-includes/js/dist/data.min.js?ver=943087ae96d075f126df689839bb96b9:2:30885)
        at t (https://example.local/wp-includes/js/dist/data.min.js?ver=943087ae96d075f126df689839bb96b9:2:31063)
        at https://example.local/wp-includes/js/dist/data.min.js?ver=943087ae96d075f126df689839bb96b9:2:22102
        at p (https://example.local/wp-includes/js/dist/data.min.js?ver=943087ae96d075f126df689839bb96b9:2:11569)
    
    Original stack trace:
        at Ge (https://example.local/wp-includes/js/dist/data.min.js?ver=943087ae96d075f126df689839bb96b9:2:30611)
        at https://example.local/wp-includes/js/dist/data.min.js?ver=943087ae96d075f126df689839bb96b9:2:31371
        at we (https://example.local/wp-includes/js/dist/vendor/react-dom.min.js?ver=16.13.1:84:293)
        at He (https://example.local/wp-includes/js/dist/vendor/react-dom.min.js?ver=16.13.1:97:464)
        at zj (https://example.local/wp-includes/js/dist/vendor/react-dom.min.js?ver=16.13.1:228:406)
        at Th (https://example.local/wp-includes/js/dist/vendor/react-dom.min.js?ver=16.13.1:152:223)
        at tj (https://example.local/wp-includes/js/dist/vendor/react-dom.min.js?ver=16.13.1:152:152)
        at Te (https://example.local/wp-includes/js/dist/vendor/react-dom.min.js?ver=16.13.1:146:151)
        at https://example.local/wp-includes/js/dist/vendor/react-dom.min.js?ver=16.13.1:61:68
        at unstable_runWithPriority (https://example.local/wp-includes/js/dist/vendor/react.min.js?ver=16.13.1:25:260)

    I also see this in the browser console when a CPT post page loads:

    data.min.js?ver=943087ae96d075f126df689839bb96b9:2 
    An error occurred while running 'mapSelect': Cannot read property 'protect_children' of undefined

    It seems to be related to the plugin. Any ideas?

    Thanks so much

    Update:
    I also see this error when editing a Reusable block in WP admin. Perhaps the plugin needs updating to ignore CPTs and Reusable blocks?

    • This topic was modified 3 years, 6 months ago by nebrekab.
    • This topic was modified 3 years, 6 months ago by nebrekab.
    • This topic was modified 3 years, 6 months ago by nebrekab.
    • This topic was modified 3 years, 6 months ago by nebrekab.
    • This topic was modified 3 years, 6 months ago by nebrekab.
Viewing 1 replies (of 1 total)
  • Thread Starter nebrekab

    (@nebrekab)

    As a temporary fix I edited /_inc/admin.php and have it ignore anything that is not a page or post (CPTs and blocks in my case).

    /**
         * Include Gutenberg specific script to add post editor checkbox in post status area.
         *
         * @return void
         */
        public function enqueue_block_editor_assets()
        {
            // !temp-fix
            global $post;
            // fix to ignore blocks and custom post types
            if($post->post_type !== 'post' || $post->post_type !== 'page'){
                return;
            }
            wp_enqueue_script(
                'ptc-myguten-script',
                PTC_PLUGIN_URL . 'build/index.js',
                array( 'wp-blocks', 'wp-element', 'wp-components' )
            );
        }
Viewing 1 replies (of 1 total)
  • The topic ‘Custom Post Type Error’ is closed to new replies.