WordPress action hook

added_post_meta

Fired by 9 WordPress plugins, running on 24K+ sites between them.

“Fires when post meta is added.”

How to use added_post_meta

It's an action: your callback runs at that point and receives 4 arguments. Nothing needs to be returned. Add this to your theme's functions.php or a small custom plugin:

functions.php
add_action( 'added_post_meta', function( $meta_id, $post_id, $meta_key, $meta_value ) {
	// Your code runs here.
}, 10, 4 );

Argument names come from Dollar Pricing for WooCommerce's source. Other plugins may pass different values: check the call in the plugin you're targeting below.

9 plugins that fire added_post_meta

Sorted by active installs. Each entry shows where the plugin calls the hook and what it passes.

  1. 404 Solution: Redirection and Page Suggestions icon 404 Solution: Redirection and Page Suggestions10,000+ installs do_action( 'added_post_meta', $metaId, $postId, $key, $rawValue ) includes/services/WordPressPostMutationNotifications.php:72
  2. ActivityPub icon ActivityPub6,000+ installs do_action( 'added_post_meta', ...$meta ) includes/class-migration.php:1107
  3. Themify Builder icon Themify Builder6,000+ installs do_action( 'added_post_meta', $mid, $post_id, self::META_KEY, $builder ) classes/class-builder-data-manager.php:1200
  4. SOOZ icon SOOZ2,000+ installs do_action( 'added_post_meta', $inserted_meta_id, $attachment_post_id, $meta_key, $hook_value ) includes/core/attachments-media.php:3020
  5. Dollar Pricing for WooCommerce icon Dollar Pricing for WooCommerceFewer than 10 installs do_action( 'added_post_meta', $meta_id, $post_id, $meta_key, $meta_value ) dolar-fiyatlandirma.php:95
  6. Sage Page Builder icon Sage Page BuilderFewer than 10 installs do_action( 'added_post_meta', $backup_id, $post_id, $backup_key, $backup ) includes/class-layout-storage.php:276
  7. Baza Booking Calendar icon Baza Booking CalendarFewer than 10 installs do_action( 'added_post_meta', $meta_id, $post_id, $meta_key, $meta_value ) classes/class-bbc-booking-meta.php:348
  8. JonnyAD SEO icon JonnyAD SEOFewer than 10 installs do_action( 'added_post_meta', $mid > 0 ? $mid : (int) $rows[0]['meta_id'], $post_id, $key, $to ) includes/admin.php:1502
  9. Evosolve Featured Images: Edit & Undo icon Evosolve Featured Images: Edit & UndoFewer than 10 installs do_action( 'added_post_meta', $after['meta'], $post, '_thumbnail_id', (string) $after['image'] ) includes/Engine.php:127

Need a customisation built on this hook?

Tell us what you want to change and which plugin it's for. We'll write it, test it and send it back as a small plugin.