delete_{$meta_type}meta
Action HookDescription
Fires immediately before deleting post or comment metadata of a specific type. The dynamic portion of the hook name, `$meta_type`, refers to the meta object type (post or comment). Possible hook names include: - `delete_postmeta` - `delete_commentmeta` - `delete_termmeta` - `delete_usermeta`Hook Information
File Location |
wp-includes/meta.php
View on GitHub
|
Hook Type | Action |
Line Number | 1069 |
Hook Parameters
Type | Name | Description |
---|---|---|
int
|
$meta_id
|
ID of the metadata entry to delete. |
Usage Examples
Basic Usage
<?php
// Hook into delete_{$meta_type}meta
add_action('delete_{$meta_type}meta', 'my_custom_function', 10, 1);
function my_custom_function($meta_id) {
// Your custom code here
}
Source Code Context
wp-includes/meta.php:1069
- How this hook is used in WordPress core
<?php
1064 *
1065 * @since 3.4.0
1066 *
1067 * @param int $meta_id ID of the metadata entry to delete.
1068 */
1069 do_action( "delete_{$meta_type}meta", $meta_id );
1070 }
1071
1072 // Run the query, will return true if deleted, false otherwise.
1073 $result = (bool) $wpdb->delete( $table, array( $id_column => $meta_id ) );
1074
PHP Documentation
<?php
/**
* Fires immediately before deleting post or comment metadata of a specific type.
*
* The dynamic portion of the hook name, `$meta_type`, refers to the meta
* object type (post or comment).
*
* Possible hook names include:
*
* - `delete_postmeta`
* - `delete_commentmeta`
* - `delete_termmeta`
* - `delete_usermeta`
*
* @since 3.4.0
*
* @param int $meta_id ID of the metadata entry to delete.
*/
Quick Info
- Hook Type: Action
- Parameters: 1
- File: wp-includes/meta.php
Related Hooks
Related hooks will be displayed here in future updates.