I Figured out the issue causing the problem in my case.
The block of code that contained acf_formhead() was being included using locate_template().
I changed the the way I included that block to use a regular include() instead and my problem was fixed.
Seems like an issue with acf_form, I’ve tried using a plugin Advanced forms to do something similar, and it submits no issues. I’d rather stick to the original acf-form if possible.
This is where the warnings are pointing to in pluggable.php
/**
* Filters the X-Redirect-By header.
*
* Allows applications to identify themselves when they're doing a redirect.
*
* @since 5.1.0
*
* @param string $x_redirect_by The application doing the redirect.
* @param int $status Status code to use.
* @param string $location The path to redirect to.
*/
$x_redirect_by = apply_filters( 'x_redirect_by', $x_redirect_by, $status, $location );
if ( is_string( $x_redirect_by ) ) {
header( "X-Redirect-By: $x_redirect_by" );
}
header( "Location: $location", true, $status );
return true;
}
endif;
My current Debug output:
Deprecated: wp_make_content_images_responsive is deprecated since version 5.5.0! Use wp_filter_content_tags() instead. in /home/ceobcmor/public_html/sepa/wp-includes/functions.php on line 5316
Deprecated: wp_make_content_images_responsive is deprecated since version 5.5.0! Use wp_filter_content_tags() instead. in /home/ceobcmor/public_html/sepa/wp-includes/functions.php on line 5316
Deprecated: wp_make_content_images_responsive is deprecated since version 5.5.0! Use wp_filter_content_tags() instead. in /home/ceobcmor/public_html/sepa/wp-includes/functions.php on line 5316
Deprecated: wp_make_content_images_responsive is deprecated since version 5.5.0! Use wp_filter_content_tags() instead. in /home/ceobcmor/public_html/sepa/wp-includes/functions.php on line 5316
Notice: Trying to access array offset on value of type bool in /home/ceobcmor/public_html/sepa/wp-content/plugins/facetwp/includes/integrations/acf/acf.php on line 214
Warning: Cannot modify header information - headers already sent by (output started at /home/ceobcmor/public_html/sepa/wp-content/themes/SEPA-UIkit/template-parts/header-content.php:1) in /home/ceobcmor/public_html/sepa/wp-includes/pluggable.php on line 1355
Warning: Cannot modify header information - headers already sent by (output started at /home/ceobcmor/public_html/sepa/wp-content/themes/SEPA-UIkit/template-parts/header-content.php:1) in /home/ceobcmor/public_html/sepa/wp-includes/pluggable.php on line 1358
I’m working to try and resolve these. I did, disable facetwp and it made no difference.
Hello, I’m currently experiencing the same thing, I’m getting a blank screen after form update/ submission.
It was working fine until the latest version of WordPress and an upgrade to PHP 7.4.
Did you ever solve this problem?
My code to generate the form.
acf_form(array(
'id' => 'acf-form-quick',
'post_title' => false,
'post_content' => true,
'field_groups' => array('group_5a3824afd298b','group_5cb4e53b433ea','group_583f59f20ee1','group_5a38276e809f8','group_5a3827b18c5c0','group_57f6b7add6a3d'),
'submit_value' => __('Update Project', 'acf'),
'html_submit_button' => '<input type="submit" class="acf-button uk-button uk-button-primary btn3d uk-margin-large-bottom uk-align-center" value="%s" />',
'return' => '%post_url%'
));
@pjpulumbarit, Are you having success with using Laravel and WordPress together?
What are the benefits? Also, do you have a live site(s) that are running using both?
Any info is greatly appreciated, thanks in advance.
This is working for me, it updates the last modified author when editing from the front end.
Just add this to your functions file.
function user_acf_save_post( $post_id )
{
update_post_meta( $post_id, '_edit_last', get_current_user_id() );//update last modified by
}
// run after save post
add_action('save_post', 'user_acf_save_post', 10);
This is working for me, it updates the last modified author when editing from the front end.
Just add this to your functions file.
function user_acf_save_post( $post_id )
{
update_post_meta( $post_id, '_edit_last', get_current_user_id() );//update last modified by
}
// run after save post
add_action('save_post', 'user_acf_save_post', 10);
Has anyone found out a way to update _edit_last in conjunction with acf_form?
If so care to share the code?
Thanks in advance!
Anyone?
How can I check if a user exists in a repeater?
This works for disabling Select-2, add a wrapper id or class to the field, then you can isolate via jquery.
jQuery("#pi_contact .select2-input").prop('disabled', true);
jQuery("#pi_contact .select2-results").remove();
I’ve tried that plugin and it doesn’t seem to run/display AFC’s the_field.
I’ve been playing with trying to use jQuery to disable input, I have it working for the date picker, but no luck on select2.
<?php // Disable AFC fields based on user role/
if( !current_user_can( 'administrator' ) ):
function disable_acf_load_field( $field ) {
$field['disabled'] = true;
return $field;
}
add_filter('acf/load_field/name=project_code', 'disable_acf_load_field');
add_filter('acf/load_field/name=project_type', 'disable_acf_load_field');
add_filter('acf/load_field/name=project_status', 'disable_acf_load_field');
add_filter('acf/load_field/name=funding_year', 'disable_acf_load_field');
add_filter('acf/load_field/name=start_date', 'disable_acf_load_field');
add_filter('acf/load_field/name=end_date', 'disable_acf_load_field');
add_filter('acf/load_field/name=state', 'disable_acf_load_field');
add_filter('acf/load_field/name=project_primary_institution', 'disable_acf_load_field');
add_filter('acf/load_field/name=pi_contact', 'disable_acf_load_field');
//Backend jquery
add_action('admin_print_footer_scripts', 'afc_disable_admin_jquery');
function afc_disable_admin_jquery(){
?>
<script>
jQuery(function(jQuery) {
jQuery(document).ready(function(){
jQuery(".hasDatepicker").prop('disabled', 'disabled');
});
});
</script>
<?php
}
endif;
Thanks, I’ll see if I can re-work this requirement with your suggestions.
So I should be able to hide the inputs via a group, yet show them via php/the_field using enhanced message field to the restricted role.
I have this working for the most part, all of my fields are disabled except for the start_date & end_date fields, those are the type “Date Picker” and the pi_contact is the type of “Post Object”.
Any ideas?
Also would is it possible to pass an array of fields to disable as list, or is using an add_filter required for each?
if( !current_user_can( 'administrator' ) ):
function disable_acf_load_field( $field ) {
$field['disabled'] = 1;
return $field;
}
add_filter('acf/load_field/name=project_code', 'disable_acf_load_field');
add_filter('acf/load_field/name=project_type', 'disable_acf_load_field');
add_filter('acf/load_field/name=project_status', 'disable_acf_load_field');
add_filter('acf/load_field/name=funding_year', 'disable_acf_load_field');
add_filter('acf/load_field/name=start_date', 'disable_acf_load_field');
add_filter('acf/load_field/name=end_date', 'disable_acf_load_field');
add_filter('acf/load_field/name=state', 'disable_acf_load_field');
add_filter('acf/load_field/name=project_primary_institution', 'disable_acf_load_field');
add_filter('acf/load_field/name=pi_contact', 'disable_acf_load_field');
endif;
I’m wondering how to make a field read only, to only users of a specific role?
For instance I have a custom post type that contains fields that should only be edited by administrators, yet viewable by contributors and editors.
Can I disable a field’s input via php or javascript based on role?
Hello, did you ever resolve this issue?
I’m having a similar issue when I’m trying to pull post_object information from inside a repeater.
other_contacts(repeater)->additional_contact(post_object)->any_custom_fields
When I try to use foreach I get numerous repetitions of the field data.
But if I use while have rows, I can get to the data and it seems to work.
If anyone is interested, here is my AFC mega menu in action.
http://www.innopak.com/
It’s using Yamm!3 http://geedmo.github.io/yamm3/
Thanks Dalton, I had a look at this plug-in, but I’m not sure if it will work with sub_fields from repeaters. In my case the content I need searched is in a nested repeater.
On the SearchWP forum I found an interesting thread, it’s dev looks like he’d like to make it work with AFC repeaters, but doesn’t see any current options.
https://searchwp.com/support/topic/any-plans-for-a-future-support-for-the-repeater-field-of-advanced-custom-fields/
It looks like it could work if you use the ‘Any’ value.
https://searchwp.com/support/topic/would-like-to-include-acf-fields-in-search-results/
It would be nice to have sub_field references available globally in some way.
Even better a built in pathway from AFC to WP search.
Imagine a checkbox on a AFC field type creation form, “Make Searchable”, you check that on the stuff you want available, and Bam your custom content will show up in search results.
I’ve tried something a bit different, instead of nested flexible content, I chose to use repeaters instead.
Here is a screen shot of my mega menu options page, it allows me to add top level link types; internal link, external link, and MultiLink Group.
Inside of MultiLink, it has a top level name, link location, and a repeater for link items.
@LudovicFauchet
Thank you for the suggestion, unfortunately this plugin does not go deep enough in my case.
Although I have tried another plug-in with a similar function that adds more granularity to what is extended to the system as searchable content.
http://bestwebsoft.com/plugin/custom-fields-search/
This plugin exposes custom fields set by AFC to the WordPress system search. It looks like the way sub_fields are stored are not global per-say; instead these are stored in a serialized manor inside of it’s global parent AFC field.
Example:
If I wanted every SKU available from every product item, regardless of it’s product group. The sub_field for product_group/product_item/item_sku is only available via a serialized instance/variant of the global product_group AFC field.
Data available to custom field search plugin:
Product_group
Product_group_0_
Product_group_0_group_description
Product_group_0_group_image
Product_group_0_group_title
Product_group_0_prodcut_item
Product_group_0_prodcut_item_0_item_description
Product_group_0_prodcut_item_0_item_images
Product_group_0_prodcut_item_0_item_sku
Product_group_0_prodcut_item_0_item_upc
As you can see any given product item’s data is only available if I directly target/choose to add the serialized product_group_#/product_item_# to the list.
Ideally it would be nice to have sub_field data exposed just like the parent fields, not a serialized instance of a parent.
Current: Product_group_0_prodcut_item_0_item_sku
Ideal: Product_group_prodcut_item_item_sku
Making sub_field references available globally regardless of a serialized parent relationship.
As a sudo fix for my problem,
I’ve also set up some top level fields for SEO, mainly a meta description and keywords for each page/product. Via the custom field search plugin, I’ve added my SEO fields to it’s list.
Now when product info is entered into a page, we also copy the SKU and name for each item into the keywords input. Then that data is available to the built in search.
Please excuse the long post,
I wanted to be thorough and share my plight on this mater to hopefully gather more incite into the gray area of AFC content & Search integration.
Thanks,
I had something similar happen, when I changed a custom field from one type to another, example I changed an existing text input into a multiline text input.
After that those inputs would not update or keep the new information.
I figured it was something to do with switching field types but using the same name. So I updated the field name also, and then the inputs started to work as expected.
I’m glad to see that this might make it into a future update.
I have had a need for this also, currently I use a repeater with text sub-fields for link name, title and the URL.
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.