Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<?php
/**
* Save the options in the meta box.
*
* @since 1.0.0
*
* @param int $post_id The ID of the current post
*/
public function save( $post_id ) {
// Note: Guard clauses removed for readability.
// Assume $metadata is set earlier in this function.
update_post_meta( $post_id, 'acme-custom-meta-data', $metadata );
}
<?php
/**
* Save the options in the meta box. Ignore the action if it's coming from the
* Bulk Edit screen.
*
* @since 1.0.0
*
* @param int $post_id The ID of the current post
*/
public function save( $post_id ) {
// Note: Guard clauses removed for readability.
// Assume $metadata is set earlier in this function.
if ( isset( $_POST['_inline_edit'] ) ) {
return;
}
update_post_meta( $post_id, 'acme-custom-meta-data', $metadata );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment