
Hi @HDcms
It is hard for me to understand your question, but perhaps you need to do some simple debugging of the available data?
Use the ACF function get_field to load in the field value and dump it out to test it. If you are not sure which files to edit, perhaps you will need to contract a developer to help you.
Thanks
E

Hi @rdck
Looking at the docs over at http://codex.wordpress.org/Class_Reference/WP_Query, your NOT LIKE code should work just fine.
Perhaps you will need to find out the computed SQL to examine what is going wrong. There are a few plugins which will render out debug information such as SQL Queries.
Thanks
E
This is what worked for me, by inserting the code into Functions.php
in admin dashboard, inside post, I type in short code like this:
[get_all_user_fields post_field=”user_aim” ], and i get all profile fields shown on front end. Hope this will help someone else.
}
if(! function_exists(‘get_all_user_fields_func’)) {
function get_all_user_fields_func( $atts ) {
extract( shortcode_atts( array(
‘post_field’ => ‘user_aim’,
), $atts ) );
$fieldsList = array(
“first_name” => “First Name”,
“last_name” => “Last Name”,
“text_aim” => “AIM”
);
$postId = get_the_ID();
$customFields = get_post_custom($postId);
if (isset($customFields[$post_field])) {
$userID = $customFields[$post_field][0];
}
else {
$userID = 0;
}
// The Query
$user_query = new WP_User_Query( array( ‘include’ => array( $userID ) ) );
// User Loop
if ( ! empty( $user_query->results ) ) {
foreach ( $user_query->results as $user ) {
foreach ( $fieldsList as $fieldName => $fieldLabel) {
$user_field = get_user_meta($userID, $fieldName);
if (isset($user_field[0])) {
$fieldValue = $user_field[0];
$out .= “<b>$fieldLabel<b>: «$fieldValue» <br/>”;
}else {
$out .= “<b>$fieldLabel<b> is not filled <br/>”;
}
}
}
} else {
$out = ‘No users found at all.’;
}
return $out;
}
add_shortcode( ‘get_all_user_fields’, ‘get_all_user_fields_func’ );
}
Just to add to this.
5) Go back and trash the fields from the main site so there aren’t duplicates.
I found instead of deleting the original fields i just put the outputted php in this if statement:
global $blog_id;
if ($blog_id != 1) {
//Output here.
}
QuietNoise, could you attach all files, which you modified?
I sent an email to the developer of Shortcode Ultimate plugin with the question. See if they got any answer to this.
I actually had a small break through yesterday by changing the way jQuery is loaded on my sites. It fixed a lot of my issues my it is still sometime quirky.
You know, your custom fields plugin is by far the best on the market. And at this point I am so deeply invested in that it is deployed on so many clients sites that I kind of got to get to root cause.
It seems the issue is also isolated to just Chrome, IE/FF work like a charm. Since the sites have been loading better I have noticed that the quirk sometimes appears when I am using HTML tags within a textarea, simple stuff like and .
Let e know if you have any more ideas. In the meanwhile I will try to debug but it’ll be a learning curve.

Hi @busybrian
Perhaps you did not understand my previous question. ACF can be used on many pages such as a post, taxonomy, user, etc.
On what screen are you using the ACF fields? Is this a normal post edit screen or something else?

Hi @john.marcello
If ACF isn’t working for you, that’s fine. There are quite a few other custom field plugins out there which you may enjoy more.
Please however, take some time to do some simple debugging with ACF’s function get_field and WP’s functions get_postmeta to compare the differences.
You may find that the issue is not with the ACF plugin, but with the code you have written in your theme.
If you are not familiar with debugging, it is not as scary as it seems. It’s just comparing visual data by printing it out to look at. Please jump on google to see some basic examples of PHP debugging.
I can’t offer much help other than the above, and I hope that you do debug and find the issue soon.
Cheers
E

Hi @uakz
Sorry, but I am unavailable for these kinds of questions. I’m glad you have got your code working, but you will need to write the custom logic yourself.
Thanks
E

Thanks for the feature request. I’ll have a look at this in the near future.
Cheers
E
to onesizeup, Thank you for sending the link about WP_User_Query, I just checked and will experiment and post back with my results. I appreciate your effort ! Good day to you !
Ed
Okay so I guess ACF used save_post to insert? At least I think and the Select queries are written on certain pages like api.php? But which file/s fetch the data into the custom post type?
Hi @elliot,
I guess the question then is why our installs are only searching in the post_title. Both me and Fade seem to have this problem. Any ideas?
Are you using WP_User_Query to display the fields in your shortcode?
Using the user ID, you should be able to display user meta data using the info here.
For example, in your shortcode, you could do this to display their AIM name.
Hope that helps,
Osu
Hi Elliot,
Thanks for getting back to me. I’ll use that information to get going and see where I get. The main issue I foresee though is that the WP_Cron functions is that they require someone to visit your site for the function to run at the scheduled time…
I guess another method might be to write a script that is run every day by a server-based cron job to check posts and send out emails if the ACF date is within a certain range.
If I’m successful with this (!), I’ll follow up on my promise of writing a tutorial for you (should you be interested).
Thanks,
Osu
Hi Elliot, I have all my layouts working fine and use the get_row_layout() to retrieve the corresponding layout file with no dramas.
What I am after is a unique identifier for each layout module.
For example, if I have two Gallery modules on the same flexible content area, I assume each one has a different ID of some kind so that the images from Gallery A are not mixed with images from Gallery B.
So when looping over the modules, is there an ID associated with each module added in the back end?
something like this….
if( get_row_layout() == 'paragraph' ):
key_id = ??????
the_sub_field('text');
elseif( get_row_layout() == 'download' ):
key_id = ??????
$file = get_sub_field('file');
endif;
Hence, each Paragraph added to the page with have unique KEY for it.
I hope I am making sense and not missing something that is easy 🙂
Thanks, Sam
I finally got it to work:
This is the code I’m using:
<?php if( get_the_author_meta('street_address_address', $curauth->ID) != '') :?>
<dt><div class="thelabels"></div>Street Address: <?php echo $curauth->street_address_address; ?></dt>
<?php endif;?>

Hi @randler
All plugins are loaded on each page load. A well written plugin will look at the current screen and load it’s ‘includes’ if needed, however, a not so well written plugin will always load all it’s ‘includes’.
Please disable all plugins to confirm the issue is related to plugins load.
Please also change your theme to the default twentythirteen. This will reveal if the issue comes from code in your theme.
Please also contact your host and ask them if they can see any stand out issues on the page load in question.
And please setup a local instal of the website for testing. This will remove many server variables and allow you to debug and find answers quickly.
Thanks
E

Hi guys.
As I have written above, ACF uses a WP_Query with a s argument to search. WP should natively search post_content in a new WP versions, but you can always hook in and modify the WP_Query args like so:
http://www.advancedcustomfields.com/resources/filters/acf-fields-relationship-query/
Thanks
E

Hi @magicstick
Thanks for the request, but this would be far too complicated for the core of ACF.
Perhaps you could think about writing this field type yourself, or contracting a developer to create it for your project?
Thanks
E
Hi Elliot,
This will be long one. I took on the performance issues related to page load once you manage to add several repeater field rows.
In my test case (9 rows with nested repeater fields) it was taking over a minute for a page to unfreeze from JS routines.
According to the JS profile I did in Chrome, majority of the JS time has been absorbed by acf.conditional_logic.refresh which is responsible for calling refresh_field for every conditional logic field. This is where the CPU time was eaten. In my case each refresh_field call took 0.2 to 0.5 seconds. Now multiply it by 255 items in CL array and you have your bottleneck. With every added repeater row this number was increasing.
The culprit is here:
var $targets = $('.field_key-' + item.field);
This cycles through all fields of given key and does the rule checking for each of them. But you do it for every item in the CL array so almost all fields are processed several time redundantly.
So the fix is to target only the particular field rather than all of the fields of given type. But it wasn’t as easy and straightforward as I initially expected. Due to the way you organised things in the first place I had to rewrite the logic in several places.
Here is a walk-through of what I did (based on 4.3.4 code and including the fixes from my previous posts in this thread).
First I changed the above mentioned line in refresh_field function to:
var $targets = $('#'+item.field_id);
but at this stage the item does not have the field_id element. So, I had find a way to include it.
In acf-repeater/views/field.php after line 218 I’ve added the following lines:
$sub_field['field_id'] = 'id_'.str_replace(array('[',']'), array('_', ''), $field['name'] . '_' . $i . '_' . $sub_field['key']);
$attributes['id'] = $sub_field['field_id'];
This resulted in id attribute being added to the TR element of the field. Also I have now field_id available in the $sub_field array which I can use later.
I’ve commented out the check for for the index clone because with the new logic now I need the reference id being added to every field (otherwise new nested rows will not have the required info in them):
// if( $i !== 'acfcloneindex' )
// {
// $sub_field['conditional_logic']['status'] = 0;
// $sub_field['conditional_logic']['rules'] = array();
// }
In acf/core/fields/_functions.php I’ve changed the last lines of create_field function to:
// conditional logic
if( $field['conditional_logic']['status'] )
{
$field['conditional_logic']['field'] = $field['key'];
?>
<div class="condition" data-condition='<?php echo json_encode($field['conditional_logic']); ?>' data-field_id="<?=$field['field_id']?>"></div>
<?php
}
I couldn’t leave the inline JS there because jQuery append function will strip it out and nested row-clones will no longer have it. Now, field_id is saved in data attribute and I moved rules object to another data attribute.
Because of the above changes I needed to create extra function which will fetch that data once the DOM is created. So, I’ve added acf.conditional_logic.get_items function in acf/js/input.min.js:
get_items : function(context) {
var _this = this;
if (typeof(context) != "undefined") {
conditions = $('.condition', context)
} else {
conditions = $('.condition')
}
conditions.each(function(){
$condition = $(this).data('condition');
$condition['field_id'] = $(this).data('field_id');
if ($condition) {
_this.items.push($condition);
}
})
},
This is rough and can be improved to not include data from row-clones. But performance impact is not that big anyway. This functions fetches all information from the data attributes which are added due to previously mentioned change.
Now we need to call this function when needed. I do it
once document is ready before the init function call:
acf.conditional_logic.get_items();
// conditional logic
acf.conditional_logic.init();
and when new repeater rows are being setup in ‘acf/setup_fields’ event handler:
$element = $(el);
$element.find('.repeater').each(function(){
acf.fields.repeater.set({ $el : $(this) }).init();
});
acf.conditional_logic.get_items($element);
In my case the edit page load time has been improved from 68 sec to 3.5 sec. The changes above also affected the response of the acf.conditional_login.change function. I hope you find this useful. Please review the suggested changes whether these break anything else and implement the fixes in next available release.
If you have any questions as to why I did something one way and not the other then please let me know.
Cheers.
Hi Elliot,
I am having the same problem as @[email protected] and @tnorthcutt
Images attach when you upload them directly to the post but they don’t attach when you select them from the Media library.
Cheers.

Thanks for the feedback.
ACF5 includes this requested functionality already, which will be out soon!
Cheers
E
Using the Basic Loop without setup_postdata(); as explained in the Relationship Field documentation ended up working.
Here is the code:
<?php $posts = get_field('event_venue'); // Relationship field
if( $posts ): ?>
<?php foreach( $posts as $p): ?>
<td>
<a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
</td>
<td>
<?php the_field('venue_address', $p->ID); ?> <?php get_field('venue_city', $p->ID); ?><?php if( get_field('venue_state', $p->ID )): ?>, <?php the_field('venue_state', $p->ID); ?><?php endif; ?> <?php the_field('venue_postcode', $p->ID); ?> <?php the_field('venue_country', $post->ID); ?>
</td>
<?php endforeach; ?>
<?php endif; // end our custom Loop within the loop ?>
I guess the question now is why the Basic Loop with setup_postdata(); doesn’t work? In any event my issue is solved!
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.