Covers the following filters:
admin_post_thumbnail_html
This filter fires within the Featured Image meta box:
One existing use is to filter the form output to include additional fields, which are processed on save_post
:
Please open a new issue to suggest additional examples of existing usage.
PostFeaturedImage is a React component used to render the Post Featured Image selection tool.
It includes a wp.hooks filter editor.PostFeaturedImage
(introduced in Gutenberg v3.3) that enables developers to replace or extend it.
Replace the contents of the panel:
wp.hooks.addFilter(
'editor.PostFeaturedImage',
'myplugin/myhook',
function() {
return function() {
return wp.element.createElement(
'div',
{},
'The replacement contents or components.'
);
}
}
);
Prepend/Append to the panel contents:
wp.hooks.addFilter(
'editor.PostFeaturedImage',
'myplugin/myhook',
function( original ) {
return function() {
return (
wp.element.createElement(
'div',
{ key: 'outer' + Math.random() },
[
'Prepend above',
_.extend( original( {} ), { key: 'my-key' } ),
'Append below'
]
)
);
}
}
);