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

Store JSON in a custom field

Yes! Yes you can! You can use this code to retrieve a stored option: $value = get_post_meta($post->ID,’customfieldname’,true); // where true means only return 1 custom field by this name You can use this code to save a stored option: update_post_meta($post->ID,’customfieldname’,$valuetobestored); The above code will need to be inside the post loop, though you can supply … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)