bobbingwide / fizzie

Fizzie theme - a Full Site Editing theme using Gutenberg blocks
9 stars 1 forks source link

Extract logic that enables text editing of `wp_template`, `wp_template_part` and `wp_navigation` to a separate plugin #75

Closed bobbingwide closed 1 year ago

bobbingwide commented 2 years ago

While updating Fizzie to work with later versions of Gutenberg ( 12.1.0 and above ) and/or WordPress 5.9 I felt I still needed the ability to (re-)enable editing of wp_template and wp_template_part. See #72 - starting from https://github.com/bobbingwide/fizzie/issues/72#issuecomment-1005604978

Now I want to reproduce this capability in blocks.wp.a2z. So I used oik-types again. But when it came to defining wp_template_part I got a Fatal error from Yoast SEO on the Template Parts admin page.

Fatal error: Uncaught TypeError: Yoast\WP\SEO\Builders\Indexable_Hierarchy_Builder::build(): 
Argument #1 ($indexable) must be of type Yoast\WP\SEO\Models\Indexable, 
bool given, called in C:\apache\htdocs\wordpress\wp-content\plugins\wordpress-seo\src\integrations\watchers\indexable-ancestor-watcher.php on line 198 
and defined in C:\apache\htdocs\wordpress\wp-content\plugins\wordpress-seo\src\builders\indexable-hierarchy-builder.php:102 
Stack trace: 
#0 C:\apache\htdocs\wordpress\wp-content\plugins\wordpress-seo\src\integrations\watchers\indexable-ancestor-watcher.php(198): Yoast\WP\SEO\Builders\Indexable_Hierarchy_Builder->build(false) 
#1 [internal function]: Yoast\WP\SEO\Integrations\Watchers\Indexable_Ancestor_Watcher->update_hierarchy_and_permalink(false, 0) #2 C:\apache\htdocs\wordpress\wp-content\plugins\wordpress-seo\src\integrations\watchers\indexable-ancestor-watcher.php(127): array_walk(Array, Array) 
#3 C:\apache\htdocs\wp-a2z\wp-includes\class-wp-hook.php(307): Yoast\WP\SEO\Integrations\Watchers\Indexable_Ancestor_Watcher->reset_children(Object(Yoast\WP\SEO\Models\Indexable), Object(Yoast\WP\SEO\Models\Indexable)) 
#4 C:\apache\htdocs\wp-a2z\wp-includes\class-wp-hook.php(331): WP_Hook->apply_filters('', Array) 
#5 C:\apache\htdocs\wp-a2z\wp-includes\plugin.php(474): WP_Hook->do_action(Array) 
#6 C:\apache\htdocs\wordpress\wp-content\plugins\wordpress-seo\src\builders\indexable-builder.php(296): do_action('wpseo_save_inde...', Object(Yoast\WP\SEO\Models\Indexable), Object(Yoast\WP\SEO\Models\Indexable)) 
#7 C:\apache\htdocs\wordpress\wp-content\plugins\wordpress-seo\src\builders\indexable-builder.php(374): Yoast\WP\SEO\Builders\Indexable_Builder->save_indexable(Object(Yoast\WP\SEO\Models\Indexable), Object(Yoast\WP\SEO\Models\Indexable)) 
#8 C:\apache\htdocs\wordpress\wp-content\plugins\wordpress-seo\src\repositories\indexable-repository.php(506): Yoast\WP\SEO\Builders\Indexable_Builder->build(Object(Yoast\WP\SEO\Models\Indexable)) 
#9 [internal function]: Yoast\WP\SEO\Repositories\Indexable_Repository->upgrade_indexable(Object(Yoast\WP\SEO\Models\Indexable)) 
#10 C:\apache\htdocs\wordpress\wp-content\plugins\wordpress-seo\src\repositories\indexable-repository.php(384): array_map(Array, Array) 
#11 C:\apache\htdocs\wordpress\wp-content\plugins\wordpress-seo\src\integrations\admin\admin-columns-cache-integration.php(109): Yoast\WP\SEO\Repositories\Indexable_Repository->find_by_multiple_ids_and_type(Array, 'post', false) 
#12 C:\apache\htdocs\wordpress\wp-content\plugins\wordpress-seo\src\integrations\admin\admin-columns-cache-integration.php(69): Yoast\WP\SEO\Integrations\Admin\Admin_Columns_Cache_Integration->fill_cache() 
#13 C:\apache\htdocs\wp-a2z\wp-includes\class-wp-hook.php(307): Yoast\WP\SEO\Integrations\Admin\Admin_Columns_Cache_Integration->maybe_fill_cache('top') 
#14 C:\apache\htdocs\wp-a2z\wp-includes\class-wp-hook.php(331): WP_Hook->apply_filters('', Array) 
#15 C:\apache\htdocs\wp-a2z\wp-includes\plugin.php(474): WP_Hook->do_action(Array) 
#16 C:\apache\htdocs\wp-a2z\wp-admin\includes\class-wp-posts-list-table.php(604): do_action('manage_posts_ex...', 'top') 
#17 C:\apache\htdocs\wp-a2z\wp-admin\includes\class-wp-list-table.php(1337): WP_Posts_List_Table->extra_tablenav('top') 
#18 C:\apache\htdocs\wp-a2z\wp-admin\includes\class-wp-list-table.php(1271): WP_List_Table->display_tablenav('top') 
#19 C:\apache\htdocs\wp-a2z\wp-admin\edit.php(477): WP_List_Table->display() 
#20 {main} thrown in C:\apache\htdocs\wordpress\wp-content\plugins\wordpress-seo\src\builders\indexable-hierarchy-builder.php on line 102

Requirement

To be able to easily copy the HTML for updated themes back into the theme's source repository while testing with both the latest version of Gutenberg and WordPress in multiple development environments.

Proposed solution

bobbingwide commented 2 years ago

But when it came to defining wp_template_part I got a Fatal error from Yoast SEO on the Template Parts admin page.

I deactivated and reactivated Yoast SEO and was not able to recreate the problem immediately.

bobbingwide commented 2 years ago

I've reproduced the Fatal error. It occurs when you delete a post.

bobbingwide commented 2 years ago

This issue was intially raised as Extract logic that enables text editing of wp_template, wp_template_part and wp_navigation to a separate plugin.

It's been hijacked by the WordPress SEO problem. Subsequently I've created a new plugin to satisfy the original requirement. See gbcptedit plugin.

bobbingwide commented 1 year ago

I retested the Fatal error problem today in blocks.wp.a2z with WordPress SEO 20.2.1, WordPress 6.1.1 and Gutenberg 15.3.1

The gbcpedit is now available but I still need to check if I've removed the extra logic from the theme.

bobbingwide commented 1 year ago

Fixed in https://github.com/bobbingwide/fizzie/commit/4700c893a586155f3e2c3eeae82c7b0d54285940 delivered in v1.2.0