It looks like you may have a conflict issue. wysiwyg field delayed init does not effect the standard WP editor and setting delayed init on one fields does not effect other wysiwyg fields.
deactivate other plugin and maybe switch themes to see if you can figure out where the conflict is.
You need to query all of the locations posts, loop through them and get the values.
$args = array(
'post_type' => 'locations',
'posts_per_page' => -1
)
$query = new WP_Query($args);
$facebook_ids = array();
if ($query->have_posts()) {
while($query->have_post()) {
$query->the_post();
$facebook_ids[] = get_field('facebook_id');
}
wp_reset_postdata()
}
echo implode(',', $facebook_ids);
You use a have_rows()
loop https://www.advancedcustomfields.com/resources/have_rows/
Is the code you posted the exact code you’re using? If it is then you have a typo in your field name
<?php
$Firstname = $_POST['acf']['field_5968834df2ac1'];
echo 'data' . $Firsname; // this is different than the line above.
?>
When are you attempting to get these values and save them? Is it in an acf/save_post action? https://www.advancedcustomfields.com/resources/acf-save_post/
If you’re having this issue please submit a new support ticket here https://support.advancedcustomfields.com/new-ticket/
I cannot recreate your issue. I created a CPT and any user type that can edit the CPT can see the custom fields I add to it. You’re issue has to be something to do with something in another plugin or your theme.
You need to figure out what you have that’s causing the issue by deactivating other plugins and narrow it down.
As far as your other questions, I don’t know how to do any of those things.
This is a very old topic. The page I linked to above appears to be no longer available. There is some information on querying by repeater fields here https://www.advancedcustomfields.com/resources/query-posts-custom-fields/
This could have something to do with the permissions set up for the post type in the theme, I think I remember something in the past similar to this. Unfortunately, I can’t really test this and I don’t remember what the solution was.
Here are a couple related topics (it seems that a pre_get_posts filter not done correctly could also do this) https://support.advancedcustomfields.com/forums/topic/custom-fields-not-showing-for-non-admin/, https://support.advancedcustomfields.com/forums/topic/acf-fields-not-showing-for-wp-membership-groups/
Have you tried using a different theme and testing to see if non-admin users can see field groups?
change order_by
to orderby
That’s interesting, when I output something similar the parent for me is the group key. In your case the parent is the post ID of the field group. I don’t know what the difference is, but whatever is in the parent is what you’ll need to look for.
The only think I can think by looking at your code is that none of your fields are in that group. Try displaying the list of fields to see what’s going on.
$fields = get_field_objects();
echo '<pre>'; print_r($fields); echo '</pre>';
Your filter is basically altering every front end query for all logged in users that can upload files. You need to be more specific about what queries to alter.
This will get you started
add_action('pre_get_posts','allow_pending_posts_wpse_103938');
function allow_pending_posts_wpse_103938($qry) {
if (!is_admin() && current_user_can('upload_files') &&
$qry->is_main_query()) {
$qry->set('post_status', array('publish','pending','draft'));
}
}
what version of ACF are you using?
Well, If I needed I’d go directly to the database, only because it would mean a lot less queries to do and would be a lot faster. This is quick to illustrate the queries. On the other hand, I don’t think that prepare can handle the ‘IN’ clause, at least I have never found anything that gives any adequate solution.
global $wpdb;
// 1. get all the post ID's of doctors
$query = 'SELECT ID
FROM '.$wpdb->posts.'
WHERE post_type = "doctor"
AND post_status = "publish"';
$ids = $wpdb->get_col($query);
// 2. get the relationship field for all of the above posts
$query = 'SELECT meta_value
FROM '.$wpdb->postmeta.'
WHERE post_id IN ("'.implode('", "', $ids).'")
AND meta_key = "my_relationship"'; // or whatever the field name is
$list = $wpdb->get_col($query);
// 3. get list of unique locations
$location_ids = array()
for ($i=0; $<count($list); $i++) {
$value = maybe_unserialize($list[$i]);
if (is_array($value)) {
for ($j=0; $j<count($value); $j++) {
if (!in_array($value[$j], $location_ids)) {
$location_ids = intval($value[$j]);
}
} // end for j
} // end if array
} // end for i
// 4. query locations
$args = array(
'post_type' => 'location',
'posts_per_page' => -1,
'post__in' => $location_ids
);
$locations = new WP_Query($args);
You could do this by looping through the fields 3 times and checking the parent. The value of $field['parent']
will be the group key for the group the field is in. So for example if your group key for the first group is group_5664a3d9a775b
foreach ($fields as $field_name => $field) {
if ($field['parent'] != 'group_5664a3d9a775b') {
// not in first group
continue;
}
// display field
}
// to 2 more times for each of the other groups
No, not using a single WP_Query. This would not be possible even if the relationship field was on locations instead of doctors.
Using a standard WP_Query you would need to first get ALL doctors and loop through the posts and collect a list of all of the locations from them and then do another query to get the locations.
Even using standard WP custom fields this would be difficult due to what it is you’re looking to get.
There might be some ways to reduce the number of queries, or speed things up by using $wpdb https://codex.wordpress.org/Class_Reference/wpdb to directly query the database.
A taxonomy field will return an array of terms even if it can only have one term.
What is being output by your code?
You can try this to see what is being returned
$term = get_field('kategorie');
echo '<pre>'; print_r($term); echo '</pre>';
What code are you using to display the gallery field?
Giving the information I have I would say that this is more than likely due to the theme or another plugin. You need to deactivate other plugins to rule them out and switch to a basic theme to rule it out.
Look for errors.
1) Are there any JavaScript errors
2) Enable debugging and turn on error logging and see if there are any PHP errors reported during the AJAX request. https://codex.wordpress.org/WP_DEBUG
if (isset($_POST['acf']) && isset($_POST['acf']['field_5964d52f052b7'])) {
unset($_POST['acf']['field_5964d52f052b7']);
}
You can’t just echo the array that you create, you’ll need to loop through the values array
foreach ($values as $value) {
echo $value;
}
There may be other ways, but I don’t recall what the correct format for a google fonts url is and I don’t know what your values actually are.
I just did a test on a site using 4.4.11 and IE11 and it seems to be working for me.
Try deactivating other plugins and/or switching themes to see if you can clear up the problem. More than likely there is some JavaScript error in IE that is causing the editor to not display correctly.
There are several ways that you can do this, the most straight forward is to loop through all of your values outside the loop and gather all of the values into an array, checking to make sure there are not duplicates
$values = array();
// your loop starts
// somewhere inside your loops where you're getting the value
$value = get_sub_field('field_name');
if (!in_array($value, $values)) {
$values[] = $value;
}
// after the end of the loop loop through the
// collectionof $values and echo what is needed
The second method would be to create an acf/update_value filter https://www.advancedcustomfields.com/resources/acf-update_value/. In this filter you can possibly look at the value and store some other post meta value that has the list so you can just get this value instead of doing the loop. This would be pretty complex and would essentially just move the code from the front end into the admin and would probably require additional coding.
Another method would be to use an output buffer http://php.net/manual/en/book.outcontrol.php
ob_start();
// your current loop for outputting content here
// with additions as shown in the first option for gathering values
// after the loop, output the link and font values
// the echo the output buffer wherever it is the content needs to be displayed
echo ob_get_clean();
I just ran the same test on with a text field and I’m not getting any extra content stored. So the question is, where is the extra content coming from? ACF is not adding it.
The first step is to see what my be causing it by deactivating plugins and switching themes.
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.