If anyone else is having issues here, the specific fix that worked for me is:
// $(document).trigger('acf/setup_fields', $("#"+ formID) );
acf.do_action('ready', $("#"+ formID) );

Wrap your acf output calls with a conditional statement using post_password_required(), example here:
http://codex.wordpress.org/Using_Password_Protection#Protect_Custom_Fields
http://codex.wordpress.org/Function_Reference/post_password_required
jacobnollette,
Thanks for the swift reply.. I did figure out what you meant and went into the db and upped the field length to 255. Will this get overwritten when wordpress updates, though? And is that the only change required? Did you not find that there is also code within wordpress that truncates those based on an assumption of a length of 64?
You need a mysql editor or edit the mysql table format with something like Sequel pro for OS X…
http://www.sequelpro.com
The problem I had was that the field “length” as described in my previous post was set too low from standard wordpress install. The field was capping the repeater field from entering the full length. Set it to 255, and you’re set. Im not sure which field anyone.. Haven’t had a fresh install in a month or two. Good luck
jacobnollette,
what do you mean about utilizing the maximum of 255 for mysql field length? What did you change and where? I may be having the same issue as you and would love to know what solved it for you. Thanks!
I found a WP ticket that says there’s currently an issue with meta_query and the ‘OR’ relation that I think is causing the issue – https://core.trac.wordpress.org/ticket/25538
As a temporary solution I’m instead filtering out all non ‘Faculty’ and ‘Staff’ members by using ‘NOT LIKE’ meta_query(s):
'meta_query' => array(
array(
'key' => 'profile_type',
'value' => 'Adjunct',
'compare' => 'NOT LIKE'
),
array(
'key' => 'profile_type',
'value' => 'Emeriti',
'compare' => 'NOT LIKE'
),
(etc...)
)
Thanks for the quick response! However, no image showed up and I got this error at the bottom:
Warning: array_reverse() expects parameter 1 to be array, boolean given in /home1/bakerdes/public_html/wp-content/themes/baker/baker-portfolio-page.php on line 143
Same like Philipp Kuehn here, my code:
if (have_rows('content-formular')):
while (have_rows('content-formular')) : the_row();
if (get_row_layout() == 'content'):
?>
<img id="image2" style="float:<?php the_sub_field('imageposition'); ?>;" src="<?php echo wp_get_attachment_url(get_sub_field('image2')); ?>" />
<div class="subhead" style="margin-<?php the_sub_field('imageposition'); ?>: 51%;"><h2><?php the_sub_field('subheadline'); ?></h2></div>
<div id="text" style="margin-<?php the_sub_field('imageposition'); ?>: 51%;"><?php the_sub_field('text'); ?></div>
<div class="clearfix"></div>
<?php
elseif (get_row_layout() == 'form'):
if (have_rows('formfelder')):
while (have_rows('formfelder')): the_row();
if (have_rows('innerform')):
echo 'pups';
while (have_rows('innerform')): the_row();
?>
<form method="post" action="#">
<?php
if (get_row_layout() == 'name'):
?>
<label for="name">Vor- und Nachname</label>
<input type="text" name="name" />
<?php
elseif (get_row_layout() == 'e-mail'):
?>
<label for="email">E-Mail-Adresse</label>
<input type="text" name="email" />
<?php
elseif (get_row_layout() == 'code'):
?>
<label for="code">Code</label>
<input type="text" name="code" />
<?php
elseif (get_row_layout() == 'street'):
?>
<label for="street">Straße und Hausnr.</label>
<input type="text" name="street" />
<?php
elseif (get_row_layout() == 'zip'):
?>
<label for="zip">PLZ</label>
<input type="text" name="zip" />
<?php
elseif (get_row_layout() == 'city'):
?>
<label for="city">Wohnort</label>
<input type="text" name="city" />
<?php
endif;
?>
</form>
<?php
endwhile;
endif;
endwhile;
endif;
?>
<?php
endif;
endwhile;
endif;
?>
I’m not sure if the code helpes, otherwise just ignore it. The form isn’t even displayed.
My Site: http://dev.scavi-ray.npire.de/
I’m also wondering what to use in place of $post_id when using save_post with an options page.
I found the following on a question related to acf_form and options. Not sure if it applies, but I’m going to try it:
Just set the post_id param to ‘options’.
I found it on this post: Using acf_form with options plugin.
My understanding is that all options pages use the options identifier, so I don’t know how you would distinguish between multiple options pages. Perhaps you could test for a unique field for each options page to determine which is which.
I will test using options in place of $post_id and let you know what I find.
ok i solved this issue. it’s simple and already documented in the plugin relatioship resources. i added a funtion in my funtions.php to add a new parameter to the query:
function my_relationship_query( $args, $field, $post )
{
// add and define tribe events eventDisplay to 'all' since it's predifined only to future.
$args['eventDisplay'] = 'all';
return $args;
}
// acf/fields/relationship/result - filter for every field
add_filter('acf/fields/relationship/query', 'my_relationship_query', 10, 3);
Is $qualite a regular array or an associative array?
One idea would to be to store the value of each $qualite in a variable and check the new one against it before outputting it. Example:
$qualite = get_field( 'qualite', $modele->ID);
if( $qualite ):
$unique = '';
foreach( $qualite as $qualite ):
if ( $unique != $qualite ) :
echo '<dd class="filtr" data-filter=".'. $qualite->ID . '">'.get_the_title( $qualite->ID ) .'</dd>';
$unique = $qualite;
else : endif;
endforeach;
endif;
The widget should have the same slug (name) on both your dev site and in your new plugin.
Here is some test generated code I exported.
if( function_exists('register_field_group') ):
register_field_group(array (
'key' => 'group_5421d12d3b08c',
'title' => 'User Registration',
'fields' => array (
array (
'key' => 'field_5421d133e4826',
'label' => 'File Upload',
'name' => 'file_upload',
'prefix' => '',
'type' => 'file',
'instructions' => 'Upload a file',
'required' => 1,
'conditional_logic' => 0,
'return_format' => 'array',
'library' => 'uploadedTo',
),
),
'location' => array (
array (
array (
'param' => 'widget',
'operator' => '==',
'value' => 'recent-comments',
),
),
),
'menu_order' => 0,
'position' => 'normal',
'style' => 'default',
'label_placement' => 'top',
'instruction_placement' => 'label',
'hide_on_screen' => '',
));
endif;
As you can see, this add a “File Upload” to the “recent-comments” widget. recent-comments is the slug associated with that widget. This location value must match the widget you are trying to target. Make sure you are assigning a slug when you generate the widget. See the codex info on creating widgets for more info.
The same, no errors, but no output.
The thing is that I’m using ACF pro with other filed types without problems, in the loop and as options page. I’ve just buy it to use the repeater field, and I followed the official reference here (http://www.advancedcustomfields.com/resources/repeater/) but is NOT working, and I need help with this.
I’m using WordPress 4.0 and the las versión of ACF Pro.
Im using it in header.php after body tag:
<!doctype html>
<html class="no-js" <?php language_attributes(); ?> >
<head>
<!--[if lt IE 9]> <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> <![endif]-->
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title><?php wp_title( '|', true, 'right' ); ?></title>
<link rel="icon" href="<?php echo get_stylesheet_directory_uri() ; ?>/assets/img/icons/favicon.ico" type="image/x-icon">
<link rel="apple-touch-icon-precomposed" sizes="144x144" href="<?php echo get_stylesheet_directory_uri() ; ?>/assets/img/icons/apple-touch-icon-144x144-precomposed.png">
<link rel="apple-touch-icon-precomposed" sizes="114x114" href="<?php echo get_stylesheet_directory_uri() ; ?>/assets/img/icons/apple-touch-icon-114x114-precomposed.png">
<link rel="apple-touch-icon-precomposed" sizes="72x72" href="<?php echo get_stylesheet_directory_uri() ; ?>/assets/img/icons/apple-touch-icon-72x72-precomposed.png">
<?php wp_head(); ?>
<?php Short_head_styles(); ?>
<?php /* ACF - Options Page */ require_once('header-custom-styles.php');?>
<script type="text/javascript">
// SLIDE NAVIGATION
$(function() {
$('a[href*=#]:not([href=#])').click(function() {
if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) {
var target = $(this.hash);
target = target.length ? target : $('[name=' + this.hash.slice(1) +']');
if (target.length) {
$('html,body').animate({
scrollTop: target.offset().top
}, 1000);
return false;
}
}
});
});
</script>
</head>
<body <?php body_class(); ?> id="home">
<section id="main-container" class="container" role="document">
<style type="">
#nav-menu{background: rgba(0,0,0,0.5);width:100%;}
</style>
<div id="nav-menu">
<div class="row"><?php CGrid_top_bar(); ?></div>
</div>
<script>
var navigation = responsiveNav(".nav-collapse", {
animate: true, // Boolean: Use CSS3 transitions, true or false
transition: 284, // Integer: Speed of the transition, in milliseconds
label: "Menu", // String: Label for the navigation toggle
insert: "after", // String: Insert the toggle before or after the navigation
customToggle: "", // Selector: Specify the ID of a custom toggle
closeOnNavClick: false, // Boolean: Close the navigation when one of the links are clicked
openPos: "relative", // String: Position of the opened nav, relative or static
navClass: "nav-collapse", // String: Default CSS class. If changed, you need to edit the CSS too!
navActiveClass: "js-nav-active", // String: Class that is added to <html> element when nav is active
jsClass: "js", // String: 'JS enabled' class which is added to <html> element
init: function(){}, // Function: Init callback
open: function(){}, // Function: Open callback
close: function(){} // Function: Close callback
});
</script>
<!-- Ressponsive Nav Menu End -->
<?php // youtube video
if ( is_front_page() && $bkg_vid_online) {
require_once('video-bkgs.php');
} ?>
<?php
// $bkg_slide_gallery = get_field('bkg_slide_gallery', 'option');
// echo $bkg_slide_gallery;
// var_dump($bkg_slide_gallery);
// check if the repeater field has rows of data
if( have_rows('bkg_slide_gallery') ):
// loop through the rows of data
while ( have_rows('bkg_slide_gallery') ) : the_row();
$image = get_sub_field('image');
echo '<img src="'. $image['url'] .'" />';
endwhile;
else :
echo "nada que mostrar"; // no rows found
endif;
?>
I have the solution. thanks for your help!!
<?php if (has_post_thumbnail( $post->ID ) ): ?>
<?php $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'single-post-thumbnail' ); ?>
<div id="custom-bg" style="background-image: url('<?php echo $image[0]; ?>')">
</div>
<?php endif; ?>
I don’t understand sorry. I get gallery with the next code. How can modify for get/show only first image of gallery? Really thanks!
<?php
$images = get_field('images');
if( $images ): ?>
<ul class="imagegallery">
<?php foreach( $images as $image ): ?>
<li>
<a href="<?php echo $image['url']; ?>" rel="lightbox">
<img src="<?php echo $image['sizes']['thumbnail']; ?>" alt="<?php echo $image['alt']; ?>" />
</a>
<?php echo $image['caption']; ?>
</li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
ok, when it’s an image field, try the following
while ( have_rows('bkg_slide_gallery') ) : the_row();
$image = get_sub_field('image');
echo '<img src="'. $image['url'] .'" />';
endwhile;

<?php $i = 0; while ( have_rows('publication_images', 148) ) : the_row(); $i++; if ($i != 1) : ?>
<div class="each-slide">
<?php echo wp_get_attachment_image(get_sub_field('publication_each_image', 148), 'slider' ); ?>
</div>
---
<?php endif; endwhile; ?>
To make it clearer this
<?php if( $qualite ): ?>
<?php foreach( $posts as $post ):
echo '<dd class="filtr" data-filter=".'. $post->ID .'">'. get_the_title( $post->ID ) .'</dd>';
?><?php endforeach; ?>
<?php endif; ?
>
is giving me multiple copies of the same. How can i strip the duplicates out? I have been looking at array_unique and DISTINCT but I can’t figure out how to implement this here.
I have currently implemented some jquery that removes the duplicates but i am not exactly happy about that solution. Any pointers. Thanks
Thanks very much for that. I have tried looking into this however I cannot seem to get this working. The Blog page that has been set as the static front page for the Blog has an ID of 11 however I cannot seem to grab any information from this page and display it within this template.
How would I be able to manipulate:
$query_object = get_queried_object();
in order to get the fields I need from the main blog page?
The code I am using to get the information I need at the moment is:
<?php
$testomonialOneText = get_field( "testomonial_1_text", 11);
$testomonialOneAuthor = get_field( "testomonial_1_author", 11);
$testomonialTwoText = get_field( "testomonial_2_text", 11);
$testomonialTwoAuthor = get_field( "testomonial_2_author", 11);
if($testomonialOneText){ ?>
<div id="testimonial-one<?php if (isset($testomonialOneText) && $testomonialTwoText == ''){?>-full-width<?php }; ?>">
<div class="testimonial"><?php echo the_field( "testomonial_1_text", 11); ?></div>
<?php if($testomonialOneAuthor){ ?><div class="testimonial-author"><strong><?php echo the_field( "testomonial_1_author", 11); ?></strong></div>
</div><!-- end of #testimonial-one -->
<?php
}};
if($testomonialTwoText){ ?>
<div id="testimonial-two">
<div class="testimonial"><?php echo the_field( "testomonial_2_text", 11); ?></div>
<?php if($testomonialOneAuthor){ ?><div class="testimonial-author"><strong><?php echo the_field( "testomonial_2_author", 11); ?></strong></div>
</div><!-- end of #testimonial-two -->
<?php
}};
?>
Thanks for your help.
Mark
I´ve the same problem. I´ve tried to follow your steps.
and I get this message ‘Advanced Custom Fields v3.0.0 requires a database upgrade.’
i press button
Migrating Options…
Migrating Location Rules…
Migrating Fields… (is stopped in this step)
if I refresh the browser i receive the same message again

Hey Elliot,
Thanks for getting back to me. The image fields are set to return arrays not IDs, and the post IDs are returning correctly.
I’m leaning towards the idea of something happening with the query too, is there something particular about how the field format settings are stored? It seems to have an issue with the automatically adding paragraphs on text area fields too, instead reverting as if auto BR tags was selected.
I’m just not exactly sure how to isolate/troubleshoot that…
To answer my own question, I stumbled on the validate_value filter, which allows me to do this. In my case, I simply wanted the input from the location field to include a city and state in the “San Francisco, CA” format, so I accomplished it like this:
function google_map_acf_validate_value( $valid, $value, $field, $input ) {
if ( ! $valid ) { // bail early if it's already invalid
return $valid;
}
preg_match( '/([^,]+), ([A-Z]{2})\b/', $value['address'], $matches );
if ( ! $matches ) { // City was not found
$valid = 'Address must include city and state';
}
return $valid;
}
add_filter( 'acf/validate_value/type=google_map', 'google_map_acf_validate_value', 10, 4 );
When you set the page as a posts page, you’re creating an archive page that is likely using a different template than a single post or page would. It’s possible to show the page’s fields on the posts page, but you would need to manipulate the code in the template that’s getting used.
The problem is that when you run the loop on the posts page, you’ll get data for the first post, not the page itself. You could get the info about the page with this:
$query_object = get_queried_object();
And then you can use the page’s ID to grab the fields from it.
First of all, you should stick your function at the top in functions.php
But to answer your question, the post_title and post_content settings are only available in ACF 5. When you look at that tutorial, make sure you’ve selected “Version 4” at the top. But more importantly, I’d suggest you upgrade to ACF 5 to do more advanced front-end forms.
I’ll echo support for this as well. It’s really common for me to set up a ‘quick links’ list which mostly is internal pages, but one or two links must be external. That one link lessens to overall usability if I make it a generic text field or have to have multiple ‘internal’ and ‘external’ fields. Something like the default WP link dialog would be excellent.
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.