Performing the metadata update
This commit is contained in:
parent
338b69d4f1
commit
c490219f75
|
|
@ -13,9 +13,9 @@ jQuery(document).ready( function($){
|
|||
post_id: $(this).data('post_id'),
|
||||
checked: $(this).prop('checked')
|
||||
},
|
||||
success: function( data ){
|
||||
console.log( data );
|
||||
}
|
||||
// success: function( data ){
|
||||
// console.log( data );
|
||||
// }
|
||||
});
|
||||
})
|
||||
});
|
||||
|
|
|
|||
|
|
@ -57,7 +57,14 @@ function wpdfh_enqueue_admin_scripts() {
|
|||
|
||||
add_action( "wp_ajax_wpdfh_set_print_metadata", "wpdfh_set_print_metadata" );
|
||||
function wpdfh_set_print_metadata(){
|
||||
error_log("PHP: wpdfh_set_print_metadata", 0);
|
||||
error_log("PHP: wpdfh_set_print_metadata, \$_POST:".print_r($_POST, true), 0);
|
||||
$post_id = $_POST['post_id'];
|
||||
$checked = $_POST['checked'];
|
||||
if ($checked == 'true') {
|
||||
update_post_meta($post_id, 'wpdfh.print', 'always');
|
||||
} else {
|
||||
delete_post_meta($post_id, 'wpdfh.print');
|
||||
}
|
||||
wp_send_json_success();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue