wppaste
WordPress

apply_filters( "delete_{$meta_type}_metadata", null|bool $delete, int $object_id, string $meta_key, mixed $meta_value, bool $delete_all )

Since
3.1.0
Short-circuits deleting metadata of a specific type.

Description

The dynamic portion of the hook name, $meta_type, refers to the meta object type (blog, post, comment, term, user, or any other type with an associated meta table).
Returning a non-null value will effectively short-circuit the function.

Possible hook names include:

  • delete_blog_metadata
  • delete_post_metadata
  • delete_comment_metadata
  • delete_term_metadata
  • delete_user_metadata

Compatibility

WordPress
since 3.1.0
  • 6.7.7
  • 6.8.8
  • 6.9.7
  • 7.0.4
  • 7.1.0

Present in every tracked release (6.7.7 to 7.1.0).

Parameters

$deletenull|bool
Whether to allow metadata deletion of the given type.
$object_idint
ID of the object metadata is for.
$meta_keystring
Metadata key.
$meta_valuemixed
Metadata value. Must be serializable if non-scalar.
$delete_allbool
Whether to delete the matching metadata entries for all objects, ignoring the specified $object_id.
Default false.

Where this hook fires · 1

  • wp-includes/meta.php:448delete_metadata()

Source code

	 * @param string    $meta_key   Metadata key.	 * @param mixed     $meta_value Metadata value. Must be serializable if non-scalar.	 * @param bool      $delete_all Whether to delete the matching metadata entries	 *                              for all objects, ignoring the specified $object_id.	 *                              Default false.	 */	$check = apply_filters( "delete_{$meta_type}_metadata", null, $object_id, $meta_key, $meta_value, $delete_all );	if ( null !== $check ) {		return (bool) $check;	} 	$_meta_value = $meta_value;	$meta_value  = maybe_serialize( $meta_value );

Changelog

Introduced in 3.1.0. Unchanged from 6.7.7 through 7.1.0.

  1. 6.7.7
  2. 6.8.8
  3. 6.9.7
  4. 7.0.4
  5. 7.1.0

Signature, return type and hooks compared across 5 parsed releases.

About this page

Parsed data
Generated from the wordpress-develop 6.9.7 tag, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
Corrections
Something wrong on this page? Report it and it gets fixed in the next regeneration.