Metabox nonce PHP notice

// Save the Metabox Data function wpt_save_product_meta($post_id, $post) { if($post->post_type!=’post type with metabox’) { return $post->ID; } // verify this came from the our screen and with proper authorization, // because save_post can be triggered at other times if ( !wp_verify_nonce( $_POST[‘product_noncename’], plugin_basename(__FILE__) )) { return $post->ID; } // Is the user allowed to edit … Read more

How to make custom comment fields required and message field not required

Here is a related question that should answer yours. Basicly you want to use the pre_comment_on_post hook function custom_validate_comment() { //validate for brief and rating if( empty( $_POST[‘brief’]) || empty( $_POST[‘rating’]) ) wp_die( __(‘Error: you must fill in both the rating and the brief’) ); //make comment not required if(empy($_POST[‘comment’]){$_POST[‘comment’] == “empty_comment”;} } add_action(‘pre_comment_on_post’, ‘custom_validate_comment’); … Read more

How to set default metaboxes on user creation?

Based on this Answer by t31os. Here, all meta boxes are being set to invisible, so simply remove from the array the ones that are meant to be visible. add_action(‘user_register’, ‘wpse_58645_set_user_metaboxes’); function wpse_58645_set_user_metaboxes( $user_id ) { update_user_meta( $user_id, ‘metaboxhidden_post’, array( ‘authordiv’, ‘categorydiv’, ‘commentstatusdiv’, ‘formatdiv’, ‘postcustom’, ‘postexcerpt’, ‘postimagediv’, ‘slugdiv’, ‘tagsdiv-post_tag’, ‘trackbacksdiv’, ) ); } For registered … Read more

Custom Fields Bulk Edit

FIRST BACKUP!!!!! NEXT, BE SURE THE BACKUP IS RIGHT Now, you can use this code in PHPMyAdmin UPDATE wp_postmeta SET meta_value = REPLACE(meta_value, ‘preview’, ‘edit’) WHERE meta_key = ‘dp_video_code’ Make sure that’s the correct name of the custom field, you can check it in the wp_postmeta table.

Delete post based on a custom field?

You don’t have a ON for your LEFT JOIN, I guess the WHERE statement you use has to be the ON statement. You should use this query instead: $querystr = ” DELETE FROM $wpdb->posts LEFT JOIN $wpdb->postmeta ON $wpdb->postmeta.post_id = $wpdb->posts.ID WHERE $wpdb->postmeta.meta_key = ‘randomID’ AND $wpdb->postmeta.meta_value=”$randomID””; Reference here: http://dev.mysql.com/doc/refman/5.0/en/join.html