Creating custom field with drop down on new post page

Instead of defining the default values for custom fields, you should do like Milo says. You should have something like this in your functions.php. I tried to follow what you need, but didn’t test it. <?php // action to add meta boxes add_action( ‘add_meta_boxes’, ‘voodoo_dropdown_metabox’ ); // action on saving post add_action( ‘save_post’, ‘voodoo_dropdown_save’ ); … Read more

Save custom user meta on registration

You have to trigger the following hooks: user_register personal_options_update edit_user_profile_update add_action(‘user_register’, ‘addMyCustomMeta’); add_action(‘personal_options_update’, ‘addMyCustomMeta’ ); add_action(‘edit_user_profile_update’,’addMyCustomMeta’ ); function addMyCustomMeta( $user_id ) { update_user_meta( $user_id, ‘user_phone’, $_POST[‘user_phone’] ); } Hope that helps!!

Advanced Custom Fields Validation

There is now, I just posted a plugin that I wrote to do validation for Advanced Custom Fields to the WordPress repository. It lets you do server side validation using either PHP code or regex, jQuery masked inputs, as well as unique value settings. http://wordpress.org/extend/plugins/validated-field-for-acf/

How to position a custom field before the editor

This can be solved using this nice snippet and edit_form_after_title hook. But I haven’t tested what happens when more than one meta box exists. With a single ACF field (position:normal, style:no-metabox) it works: add_action( ‘edit_form_after_title’, ‘pre_title_metabox_wpse_94530’ ); function pre_title_metabox_wpse_94530() { global $post, $wp_meta_boxes; do_meta_boxes( get_current_screen(), ‘normal’, $post ); unset( $wp_meta_boxes[‘post’][‘normal’] ); } And if it … Read more

Filtering a WP_Query meta_query by numeric values isn’t working

Try an array of arrays in your meta query. $args = Array( ‘post_type’ => ‘event’, ‘posts_per_page’ => -1, ‘meta_key’ => ‘event_date’, ‘orderby’ => ‘meta_value_num’, ‘order’ => ‘ASC’, ‘meta_query’ => array( array( ‘key’ => ‘event_date’, ‘compare’ => ‘>=’, ‘value’ => intval(strtotime(date(‘Y-m-d’))), ‘type’ => ‘numeric’ ) ), ); $query = new WP_Query( $args );

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