Skip to content

Instantly share code, notes, and snippets.

@brynzovskii
Created March 15, 2018 13:17
Show Gist options
  • Save brynzovskii/203aad1c6703a34bab127cf9d1355cb2 to your computer and use it in GitHub Desktop.
Save brynzovskii/203aad1c6703a34bab127cf9d1355cb2 to your computer and use it in GitHub Desktop.
WP before post inserting hook
<?php
add_action( 'wp_insert_post', 'wpse128767_add_meta' );
function wpse128767_add_meta( $post_id ) {
// do something here, add post meta for example
add_post_meta( $post_id, 'key', 'value' );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment