[wp-trac] [WordPress Trac] #32605: Add short-circuit filters to `*_metadata_by_mid()` functions

WordPress Trac noreply at wordpress.org
Fri Jul 31 17:01:36 UTC 2015


#32605: Add short-circuit filters to `*_metadata_by_mid()` functions
-----------------------------------------+------------------------------
 Reporter:  dlh                          |       Owner:
     Type:  enhancement                  |      Status:  new
 Priority:  normal                       |   Milestone:  Awaiting Review
Component:  Options, Meta APIs           |     Version:
 Severity:  normal                       |  Resolution:
 Keywords:  has-patch reporter-feedback  |     Focuses:
-----------------------------------------+------------------------------

Comment (by Er_eri):

 Can you please make a simple save function as it is for
 update_post_meta()? I need one function for ajax updating meta_id. Please,
 i need just one simple example for updating the meta_id. Thanks in advance

 For example like this:

 {{{
 add_action( 'wp_ajax_my_action', 'isave_meta' );
 function isave_meta( $post_id ) {

 if( wp_verify_nonce( $_REQUEST['nonce'], 'update_meta' ) ) {
 if( update_post_meta( $_POST['post_id'], 'my_meta_key',
 sanitize_text_field( $_POST[ 'my_meta_key' ] ) ) )
 }
 else { wp_die( '-1'); }
 }

 }}}

--
Ticket URL: <https://core.trac.wordpress.org/ticket/32605#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list