Skip to content

Instantly share code, notes, and snippets.

@rfmeier
Last active January 20, 2016 20:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rfmeier/df9e0cdf23b497d90d11 to your computer and use it in GitHub Desktop.
Save rfmeier/df9e0cdf23b497d90d11 to your computer and use it in GitHub Desktop.
Hook register_meta() into WordPress 'init'
<?php //* do not include php tag
add_action( 'init', 'register_my_sample_meta' );
/**
* Callback for WordPress 'init' action.
*
* Register the post meta.
*
* @uses register_meta()
* @see https://codex.wordpress.org/Function_Reference/register_meta
*
* @return void
*/
function register_my_sample_meta() {
register_meta(
'post', //* the post type
'sample_count', //* the meta key
'sanitize_sample_count_meta', //* the callable sanitize function
'auth_sample_count_meta' //* the optional authenticate function
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment