Solved it! Tackled it in a different way.
<?php
$args = array(
'date_query' => array(
array(
'after' => '-' . (intval(date('N')) - 1) . 'days',
'inclusive' => true
)
),
'post_type' => 'ride', 'posts_per_page' => 10, 'orderby' => 'meta_value_num', 'order' => 'desc',
);
$leaders = new WP_Query( $args );
?>
Thanks that did the trick!
How about updating to 5.0 and running the classic editor plugin, any ideas how ACF will perform in that scenario?
Thanks!
For anyone else looking for how to do this add this to your map function.
// Add the circle for this marker to the map.
var cityCircle = new google.maps.Circle({
strokeColor: "#9BCCDF",
strokeOpacity: 0.8,
strokeWeight: 2,
fillColor: "#9BCCDF",
fillOpacity: 0.35,
map: map,
center: latlng,
radius: 40233.6,
draggable: false
});
Thanks @keithlock your reply gives me the confidence to get cracking with the project.
I may get tripped up when it comes to doing the actual calculations, but I’ll start a new thread for any specific topic.
Thanks so much.
Hi James
Thanks for replying. The plugin author confirmed that there is no notification for ‘Publish to Publish’ posts / pages as they can cause conflicts with other plugins that immediately publish posts.
Thanks
Leanda
Thanks for replying. I re-thought how to build it in the end.
That worked great, thanks!
Hi guys thanks for replying.
Sadly I still can’t figure this one out 🙁 I’ve switched it to use the field key and changed the priority to 10 and now when I submit the form I get a white screen (500). I’ve even tried setting the field type from text to url.
It’s got me stumped this one because is works so well for the email field.
Here’s the updated code:
function my_acf_save_post_url( $post_id ) {
// bail early if no ACF data
if( empty($_POST['acf']) ) {
return;
}
// bail early if editing in admin
if( is_admin() ) {
return;
}
if( $_POST['post_id'] != 'new' ) {
$urlField = $_POST['acf']['field_57861544dfb0f'];
$wp_user_id = str_replace("user_", "", $post_id);
if (isset($urlField)) {
if (url_exists( $urlField )){
// Email exists, do not update value.
// Maybe output a warning.
update_field('field_57861544dfb0f', get_the_author_meta('user_url',$wp_user_id), $post_id);
} else {
$args = array(
'ID' => $wp_user_id,
'user_url' => esc_attr( $urlField )
);
wp_update_user( $args );
}
}
}
// return the ID
return $post_id;
}
add_action('acf/save_post', 'my_acf_save_post_url', 10);
Could I be missing something in my form options:
$options = array(
'post_id' => 'user_'.$current_user->ID, // $user_profile,
'field_groups' => array(225),
'submit_value' => 'Update Profile',
'uploader' => 'basic'
);
Thanks for your help, very much appreciated.
Me again! So the above code worked beautifully for the email address, thanks @raffacake but I thought I might be able to do the same thing for the user_url however I don’t seem to be able to get it working.
Any ideas where I might be going wrong?
Thanks
function my_acf_save_post_website( $post_id ) {
// bail early if no ACF data
if( empty($_POST['acf']) ) {
return;
}
// bail early if editing in admin
if( is_admin() ) {
return;
}
if( $_POST['post_id'] != 'new' ) {
$urlField = $_POST['acf']['profile_website'];
$wp_user_id = str_replace("user_", "", $post_id);
if (isset($urlField)) {
if (url_exists( $urlField )){
// Website exists, do not update value.
// Maybe output a warning.
update_field('profile_website', get_the_author_meta('user_url',$wp_user_id), $post_id);
} else {
$args = array(
'ID' => $wp_user_id,
'user_url' => esc_attr( $urlField )
);
wp_update_user( $args );
}
}
}
// return the ID
return $post_id;
}
add_action('acf/save_post', 'my_acf_save_website', 20);
Thanks @raffacake that works brilliantly!
Hi @raffacake
I’m trying to achieve the same thing. I was wondering if you’d mind sharing the code you used in the functions.php to save the email address?
Many thanks
Leanda
Thanks @joachim for this temporary fix. Any news on a permanent fix?
Thanks
Glad you found a solution, that might just come in handy for me on an upcoming project. Thanks for sharing.
No worries, such a silly gotcha. I wonder if that could be clearer or added to the docs somewhere.
Problem solved! Because the image field settings already specified ‘MB’ at the end of the field, I was only inserting the numerical value, whereas it actually needs the mb repeating – 5mb not just the 5.
Hopefully this might help out someone else.
Just the ticket, thanks!
Actually, it is running is a subdir, but that’s not the problem. I just spoke to the host and it triggered a security rule when I tried to send a url via the form. They cleared the rule and then it triggered a second rule. Everything is cleared for now, so fingers crossed.
Thanks
— Leanda
Hi Jonathan
Thanks for the quick response.
The field is named ephemera_instagram so not a generic name. I’ve raised a support ticket with the host to see if it’s something they are blocking.
I’ll feedback once they have looked into it.
Thanks
Solved it with a filter.
add_filter('acf/fields/taxonomy/wp_list_categories', 'my_taxonomy_args', 10, 2);
function my_taxonomy_args( $args, $field )
{
$args['exclude'] = array(16, 15, 17); //the IDs of the excluded terms
return $args;
}
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.