How do you add a custom option to user data?

To add a field to the profile/user edit page you need to use the edit_user_profile hook and show_user_profile hook so: add_action( ‘show_user_profile’, ‘my_extra_user_fields’ ); add_action( ‘edit_user_profile’, ‘my_extra_user_fields’ ); function my_extra_user_fields( $user ) { ?> <h3>User avatar</h3> <table class=”form-table”> <tr> <th><label for=”user_avatar”>User avatar</label></th> <td> <input id=”user_avatar” name=”user_avatar” type=”text” value=” <?php $user_avatar = get_the_author_meta( ‘user_avatar’, $user->ID ); … Read more

Arrange custom fields with drag and drop?

In this example of repeatable custom fields, we can see that the following jQuery is needed: $(‘#repeatable-fieldset-one tbody’).sortable({ opacity: 0.6, revert: true, cursor: ‘move’, handle: ‘.sort’ }); And the HTML it controls is (simplified): <table id=”repeatable-fieldset-one” width=”100%”> <thead> <tr> <th width=”2%”></th> <th width=”30%”>Name</th> <th width=”60%”>URL</th> <th width=”2%”></th> </tr> </thead> <tbody> <?php if ( $repeatable_fields ) … Read more

Filtering a WP Query result

I solved my problem re-reading ACF’s custom fields documentation. Instead of meta_query, I should’ve used meta_key. The correct argument for a custom field is: // args $args = array( ‘numberposts’ => -1, ‘post_type’ => ‘event’, ‘meta_key’ => ‘location’, ‘meta_value’ => ‘Melbourne’ );

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