Created
September 21, 2016 04:59
-
-
Save jpen365/e4b775d0834ac3e5c6e6dba939a0ecd9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* Save the input to post_meta_data */ | |
function jpen_save_custom_post_order( $post_id ){ | |
if ( !isset( $_POST['jpen_custom_post_order_nonce'] ) || !wp_verify_nonce( $_POST['jpen_custom_post_order_nonce'], basename( __FILE__ ) ) ){ | |
return; | |
} | |
if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ){ | |
return; | |
} | |
if ( ! current_user_can( 'edit_post', $post_id ) ){ | |
return; | |
} | |
if ( isset( $_REQUEST['pos'] ) ) { | |
update_post_meta( $post_id, '_custom_post_order', sanitize_text_field( $_POST['pos'] ) ); | |
} | |
} | |
add_action( 'save_post', 'jpen_save_custom_post_order' ); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment