/**
* URL Rewrite
*/
add_action( 'generate_rewrite_rules', 'custom_rewrite_rules' );
function custom_rewrite_rules()
{
// get global rules
global $wp_rewrite;
// add custom rules
$new_rules = array(
"artists/([^/]+)/works/?" => "index.php?post_type=artists&post_name=" . $wp_rewrite->preg_index(1)
);
// put custom rules into global rules
// or use array_push() ...
$wp_rewrite->rules = $new_rules + $wp_rewrite->rules;
}
// go to settings -> permalinks to flush your rules
Check out generate_rewrite_rules here … btw its not an issue from ACF!
It works, but does not look really good!
<?php if (have_rows('version', 10081)): ?>
<?php $start = 1; $end = 1; ?> <!-- start and ending number -->
<?php while (have_rows('version', 10081)) : the_row(); ?>
<?php if( $start <= $end ): ?> <!-- if start <= ending number, show -->
<div class="row row-download row-download<?php echo get_row_index(); ?>">
<div class="col-md-2">
<?php the_sub_field('version_number'); ?>
<?php endif; ?>
<?php $start++; ?> <!-- start + 1 -->
<?php endwhile; ?>
<?php endif; ?>
Count your entries and only show the first entry.
Why not using acf_add_local_field_group? (Check here and here)
Are you using your form within the WordPress Loops? And have you also included acf_form_head()?
What if you create an image field with ACF and use the same ID?
You’re awesome John! Thank you! Work like a charm!
1) Set the priority for your action > 10
This helped me! 🙂 But now i cant check, if a field is updated or not, or?
Still not working. I use acf_form() to update a user profile in frontend…
acf_form_head() is set and my form looks like:
$groups = array( 1, 2, 3, 4 );
acf_form(array(
'post_id' => 'user_' . get_current_user_id(),
'field_groups' => $groups,
));
Fields are saving perfect, but field “network_public” does not update. field network_public is an field in a field_group in the acf_form.
The script for set network_public to false, is the same as above (posted recently from me).
So if i use (is it correct?) it should work?
function 123_update_user( $post_id )
{
if (strpos($post_id, 'user_') !== 0)
return;
$user_id = intval(substr($post_id, 5));
update_user_meta( $user_id, 'network_public', false);
}
add_action( 'acf/save_post', '123_update_user', 5 );
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 Privacy Policy. If you continue to use this site, you consent to our use of cookies.