You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've searched for any related issues and avoided creating a duplicate issue.
Please give us a description of what happened
The "rest_after_insert_{$enabled_post_type}" actions are added too early, there is no way to add a duplicate_post_enabled_post_types filter before them.
The solution would be to add these actions in init action or similar, so these lines would be executed in init: https://github.com/Yoast/duplicate-post/blob/trunk/src/post-republisher.php#L48-L55
This would give the themes/plugins chance to register duplicate_post_enabled_post_types filter before the REST hooks.
To Reproduce
Step-by-step reproduction instructions
Add duplicate_post_enabled_post_types filter in your theme or plugin.
Observe that "rest_after_insert_{$enabled_post_type}" action is registered only for post types from the settings not including ones added through duplicate_post_enabled_post_types filter.
Expected results
The duplicate_post_enabled_post_types should allow to set custom post types that can be then used to add "rest_after_insert_{$enabled_post_type}" actions.
Actual results
The "rest_after_insert_{$enabled_post_type}" actions are set before the theme or plugin has a chance to set duplicate_post_enabled_post_types filter.
This results in An error occurred while deleting the Rewrite & Republish copy. error when you try to duplicate custom post type set in duplicate_post_enabled_post_types filter.
Screenshots, screen recording, code snippet
I get this error when I try to rewrite & republish a custom post type added through filter duplicate_post_enabled_post_types:
Technical info
If relevant, which editor is affected (or editors):
Block Editor
Gutenberg Editor
Classic Editor
Other:
Which browser is affected (or browsers):
Chrome
Firefox
[x ] Safari
Opera
Used versions
Device you are using: PC
Operating system: Windows 10
PHP version: 8.2
WordPress version: 6.5.5
WordPress Theme: Twenty-Twenty
Yoast Duplicate Post version: 4.5
Gutenberg plugin version:
Classic Editor plugin version:
Relevant plugins in case of a bug: none
The text was updated successfully, but these errors were encountered:
Please give us a description of what happened
The
"rest_after_insert_{$enabled_post_type}"
actions are added too early, there is no way to add aduplicate_post_enabled_post_types
filter before them.The solution would be to add these actions in
init
action or similar, so these lines would be executed ininit
: https://github.com/Yoast/duplicate-post/blob/trunk/src/post-republisher.php#L48-L55This would give the themes/plugins chance to register
duplicate_post_enabled_post_types
filter before the REST hooks.To Reproduce
Step-by-step reproduction instructions
duplicate_post_enabled_post_types
filter in your theme or plugin."rest_after_insert_{$enabled_post_type}"
action is registered only for post types from the settings not including ones added throughduplicate_post_enabled_post_types
filter.Expected results
duplicate_post_enabled_post_types
should allow to set custom post types that can be then used to add"rest_after_insert_{$enabled_post_type}"
actions.Actual results
"rest_after_insert_{$enabled_post_type}"
actions are set before the theme or plugin has a chance to setduplicate_post_enabled_post_types
filter.An error occurred while deleting the Rewrite & Republish copy.
error when you try to duplicate custom post type set induplicate_post_enabled_post_types
filter.Screenshots, screen recording, code snippet
I get this error when I try to rewrite & republish a custom post type added through filter
duplicate_post_enabled_post_types
:Technical info
Used versions
The text was updated successfully, but these errors were encountered: