Secure way to use name_save_pre?
Validate input values and sanitize outputting data. Take a read good article about Data Sanitization and Validation With WordPress, it will make you understanding these principles better.
Validate input values and sanitize outputting data. Take a read good article about Data Sanitization and Validation With WordPress, it will make you understanding these principles better.
In another question of yours, you were pointed to the plugin WP Favorite Posts, but you seem to have settled with this premium one from Code Canyon. So, the matter is how to integrate it with a Profile/Registration management plugin, and for that maybe Theme My Login would be a good candidate, as you can … Read more
You can check the request value, before save and get an hint via wp_die() add_action( ‘save_post’,’wpse46583_save’, 10, 2 ); function wpse46583_save( $post_id, $post ) { // verify this is not an auto save routine. if ( defined(‘DOING_AUTOSAVE’) && DOING_AUTOSAVE ) return; // You should check nonces and permissions here if ( ! current_user_can( ‘edit_page’, $post_id … Read more
The second argument of the save_post action contains the post data: do_action(‘save_post’, $post_ID, $post); You can also hook post_updated which will let you easily compare the before/after data: do_action( ‘post_updated’, $post_ID, $post_after, $post_before);
I have modified your code as following and it is working for me. I have removed the constructor from your code and added the code in method and called that method using object. if (is_admin()){ add_action(‘load-post.php’, array(‘Mighty_Metabox’ , ‘Custom_Mighty_Metabox’)); } //the class class Mighty_Metabox{ //the vars public $id = false; public $title = false; public … Read more
Instead of taking meta values from get_post_meta function take it from $postarr array because when initial publishing of the post there isn’t any values for event_datestart and venue_name in database and it returns empty string. Updated Code : function set_event_title( $data , $postarr ) { if($data[‘post_type’] == ‘event’) { $getdate = $postarr[‘event_datestart’]; // Replace event_datestart … Read more
WordPress post “saves” work by posting, processing, and redirecting back to the originating page. Put a die after your error and you should see your errors when appropriate. Without that, the page redirects before you see the error message. In my opinion you would be better off turning on debugging and writing to the error … Read more
The answer appears to be clear if you look at the source code. The action you’re hooking to occurs inside wp_insert_post, and is called just before it returns the $post_ID variable. This means that all the manipulation and data insertion has already taken place, so modifying the $_POST array will do nothing. You must look … Read more
After some searching and working off of some pointers from toscho, and some other helpful posts to avoid an infinite loop I managed to figure out a solution. I’ll post the code below then briefly explain: // Hook into the actions here public function __construct() { add_action( ‘add_meta_boxes’, array($this, ‘meta_boxes’ )); add_action( ‘save_post’, array($this, ‘save_bio_data’ … Read more
I would recommend you to remove custom fields meta box from the post editing page. You can do it by using remove_meta_box() function. add_action( ‘admin_menu’ , ‘wpse8170_remove_post_custom_fields’ ); function wpse8170_remove_post_custom_fields() { remove_meta_box( ‘postcustom’ , ‘post’ , ‘normal’ ); }