wp-includes/comment.php:
do_all_trackbacks()
|
Perform all trackbacks.
|
wp-includes/comment.php:
do_all_enclosures()
|
Perform all enclosures.
|
wp-includes/comment.php:
do_all_pingbacks()
|
Perform all pingbacks.
|
wp-includes/post.php:
wp_check_for_changed_dates()
|
Check for changed dates for published post objects and save the old date.
|
wp-admin/includes/class-wp-privacy-policy-content.php:
WP_Privacy_Policy_Content::get_suggested_policy_text()
|
Check for updated, added or removed privacy policy information from plugins.
|
wp-admin/includes/class-wp-privacy-policy-content.php:
WP_Privacy_Policy_Content::_policy_page_updated()
|
Update the cached policy info when the policy page is updated.
|
wp-admin/includes/privacy-tools.php:
wp_privacy_process_personal_data_export_page()
|
Intercept personal data exporter page Ajax responses in order to assemble the personal data export file.
|
wp-admin/includes/privacy-tools.php:
wp_privacy_generate_personal_data_export_file()
|
Generate the personal data export file.
|
wp-includes/class-wp-customize-manager.php:
WP_Customize_Manager::handle_dismiss_autosave_or_lock_request()
|
Delete a given auto-draft changeset or the autosave revision for a given changeset or delete changeset lock.
|
wp-includes/nav-menu.php:
_wp_delete_customize_changeset_dependent_auto_drafts()
|
Delete auto-draft posts associated with the supplied changeset.
|
wp-includes/class-wp-customize-nav-menus.php:
WP_Customize_Nav_Menus::save_nav_menus_created_posts()
|
Publish the auto-draft posts that were created for nav menu items.
|
wp-admin/includes/class-custom-image-header.php:
Custom_Image_Header::ajax_header_remove()
|
Given an attachment ID for a header image, unsets it as a user-uploaded header image for the current theme.
|
wp-includes/functions.php:
wp_scheduled_delete()
|
Permanently delete comments or posts of any type that have held a status of ‘trash’ for the number of days defined in EMPTY_TRASH_DAYS.
|
wp-includes/class-wp-embed.php:
WP_Embed::delete_oembed_caches()
|
Delete all oEmbed caches. Unused by core as of 4.0.0.
|
wp-includes/post.php:
set_post_thumbnail()
|
Sets the post thumbnail (featured image) for the given post.
|
wp-includes/post.php:
delete_post_thumbnail()
|
Removes the thumbnail (featured image) from the given post.
|
wp-includes/post.php:
wp_check_for_changed_slugs()
|
Check for changed slugs for published post objects and save the old slug.
|
wp-includes/post.php:
wp_delete_attachment()
|
Trash or delete an attachment.
|
wp-includes/post.php:
wp_update_attachment_metadata()
|
Updates metadata for an attachment.
|
wp-includes/post.php:
wp_untrash_post_comments()
|
Restore comments for a post from the Trash.
|
wp-includes/post.php:
wp_insert_post()
|
Insert or update a post.
|
wp-includes/post.php:
wp_delete_post()
|
Trash or delete a post or page.
|
wp-includes/post.php:
wp_untrash_post()
|
Restores a post from the Trash.
|
wp-includes/post.php:
update_attached_file()
|
Update attachment file path based on attachment ID.
|
wp-includes/nav-menu.php:
wp_update_nav_menu_item()
|
Save the properties of a menu item or create a new one.
|
Default Usage
Other Examples
Let’s assume we had a plugin that added some meta values to posts, but now when we are uninstalling the plugin, we want to delete all the post meta keys that the plugin added. Assuming the plugin added the keys
related_posts
andpost_inspiration
.To delete all the keys use
delete_post_meta_by_key( $post_meta_key )
. This would be added to the “uninstall” function:Or, if you wanted to delete all the keys except where
post_inspiration
was “Sherlock Holmes”:Or maybe post number 185 was just deleted, and you want to remove all
related_posts
keys that reference it:Be VERY careful when using this function to delete a specific key-value pair. As stated in
delete_metadata()
‘s documentation, providing an empty string for$meta_value
will cause the check to be skipped entirely, resulting in all keys being deleted!To avoid accidentally deleting ALL key instances, use a short-circuit check: