wordpress-seo
wordpress-seo copied to clipboard
Decouple Schema hidden fields
- [ ] schema_page_type - SchemaFields - redux/actions/schemaTab.js, /containers/SchemaTab.js
- [ ] schema_article_type - SchemaFields - redux/actions/schemaTab.js, /containers/SchemaTab.js
Relevant technical choices:
- I have removed the default value property name for
schema_page_typeininc/class-wpseo-meta.phpline 422 , all other metadata defs are usingdefault_valueand the property is used when getting the value. - I have removed the adding of defaults of schema metadata from the fields defs, since it is not used as default in the value itself but is used in the front end. I added the defaults to
admin/formatter/class-post-metabox-formatter.phpmetaboxwindow object and then used it in the store for initial state of the default values. That is used then in the dropdown list of schema types.
Actions
Cleanup reducer, container and component
- packages/js/src/redux/reducers/schemaTab.js
- packages/js/src/containers/SchemaTab.js
- packages/js/src/components/SchemaTab.js
Initial state
Old side effect files to be removed
Sync files
- packages/js/src/helpers/fields/hiddenFieldsSync.js
- packages/js/src/helpers/fields/blockEditorSync.js
Fix setting default value for schema fields to match others property
Test instructions:
-
Edit a post
-
Go to schema tab in the metabox or the block editor sidebar
-
Check you see the defaults in brackets
-
Change Page type and Article type and save
-
[ ] Check the values are saved
-
Edit a Page
-
[ ] Check there is no Article type field
-
Change Page type and Article type and save
-
[ ] Check the values are saved
-
[ ] Repeat the steps for elementor
-
Create a custom post type without author support (use Custom Post Type UI plugin)
-
Check schema tab doesn't contain article type.
Test without metabox
- Comment out line 81 in
class-metabox.php:
// add_action( 'add_meta_boxes', [ $this, 'add_meta_box' ] );
- Edit a post
- Go to schema tab in the block editor sidebar
- Change Page type and Article type and save
- [ ] Check the values are saved
- Edit a Page
- [ ] Check there is no Article type field
- Change Page type and Article type and save
- [ ] Check the values are saved
- [ ] Repeat the steps for elementor and check it is saved.