Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Notice: map_meta_cap was called <strong> incorrectly </strong>. The post type jp_sitemap has not been registered, so checking the ability to "edit_post" against such a post may not be reliable. #177

Closed
rebeccahum opened this issue Aug 12, 2019 · 1 comment · Fixed by #178
Assignees
Labels
type:bug Something isn’t working.
Milestone

Comments

@rebeccahum
Copy link
Contributor

rebeccahum commented Aug 12, 2019

Describe the bug
When using Jetpack 7.6 and SRM, you see this notice when cron runs:

Notice: map_meta_cap was called <strong> incorrectly </strong>. The post type jp_sitemap has not been registered, so checking the ability to "edit_post" against such a post may not be reliable. Read as <a href="https://codex.wordpress.org/en-US:Debugging_a_WordPress Network"> Debugging WordPress </a> for more information. (This message was added in version 4.4.0.) In in /chroot/var/www/wp-includes/functions.php on line 4773

Stack trace:

[/chrootwp-includes/functions.php:4773 trigger_error(), /chrootwp-includes/capabilities.php:155 _doing_it_wrong(), /chrootwp-includes/class-wp-user.php:740 map_meta_cap(), /chrootwp-includes/capabilities.php:649 WP_User->has_cap(), /chrootwp-content/plugins/safe-redirect-manager/safe-redirect-manager.php:505 current_user_can(), /chrootwp-includes/class-wp-hook.php:288 SRM_Safe_Redirect_Manager->action_save_post(), /chrootwp-includes/class-wp-hook.php:310 WP_Hook->apply_filters(), /chrootwp-includes/plugin.php:465 WP_Hook->do_action(), /chrootwp-includes/post.php:3951 do_action('save_post'), /chrootwp-includes/post.php:4028 wp_insert_post(), /chrootwp-includes/post.php:2988 wp_update_post(), /chrootwp-content/mu-plugins/jetpack/modules/sitemaps/sitemap-librarian.php:210 wp_trash_post(), /chrootwp-content/mu-plugins/jetpack/modules/sitemaps/sitemap-librarian.php:184 Jetpack_Sitemap_Librarian->delete_sitemap_type_data(), /chrootwp-content/mu-plugins/jetpack/modules/sitemaps/sitemaps.php:507 Jetpack_Sitemap_Librarian->delete_all_stored_sitemap_data(), /chrootwp-includes/class-wp-hook.php:286 Jetpack_Sitemap_Manager->callback_action_purge_data(), /chrootwp-includes/class-wp-hook.php:310 WP_Hook->apply_filters(), /chrootwp-includes/plugin.php:465 WP_Hook->do_action(), /chrootwp-content/mu-plugins/jetpack/class.jetpack.php:452 do_action('jetpack_sitemaps_purge_data'), /chrootwp-includes/class-wp-hook.php:286 Jetpack::upgrade_on_load(), /chrootwp-includes/class-wp-hook.php:310 WP_Hook->apply_filters(), /chrootwp-includes/plugin.php:465 WP_Hook->do_action(), /chrootwp-settings.php:546 do_action('wp_loaded')

When jp_sitemap posts get deleted during the sitemap cron, SRM runs a capability check on every post during the save_post event, triggering a “doing it wrong” warning.

@rebeccahum rebeccahum added the type:bug Something isn’t working. label Aug 12, 2019
@jeffpaul jeffpaul added this to the 2.0.0 milestone Aug 12, 2019
@jeffpaul
Copy link
Member

@rebeccahum welcome to Safe Redirect Manager and thanks for the Jetpack feedback and related PR! I've milestoned these for our next release, though that's currently unscheduled but I'll keep you posted as we get through planning and review if there's anything else needed on this issue and related PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:bug Something isn’t working.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants