Forum Replies Created

  • I’m wrestling with this right now as well — any luck as of yet?

  • I, too, am trying to use this same method but with a get_sub_field call. I have modified Elliot’s original code but I’m unable to get the field without the wpautop happening. Any suggestions on this one?

    Here’s what I am attempting to use:

    function get_sub_field_without_wpautop($field_name) {
    	// Temporarily remove the filter for this get_sub_field call
    	remove_filter('acf_the_content', 'wpautop');
    	// Get the sub field without the wpautop filter
    	$field = get_sub_field($field_name);
    	// Re-establish the wpautop filter for everything
    	add_filter('acf_the_content', 'wpautop');
    	// Return our non-wpautop'd field
    	return $field;
  • Here’s what I did, since most of the time there are multiple admins on the site but I don’t want any besides myself editing the Custom Fields:

    add_filter('acf/settings/show_admin', 'my_acf_show_admin');
    function my_acf_show_admin($show) {
    	// provide a list of usernames who can edit custom field definitions here
    	$admins = array( 
    	// get the current user
    	$current_user = wp_get_current_user();
    	return (in_array($current_user->user_login, $admins));
  • Yeah, that’s what I thought. Was going to try to avoid user accounts but I agree that could be dangerous.

    Originally I was using gravity forms to do this form (which allows non-logged in users to upload) but it unfortunately doesn’t integrate the Plupload functionality which I wanted.

    Time to rethink what I need to do. Thanks!

  • Another quick somewhat related question. I try uploading files as a logged out user and get an uploading error:
    An error occurred in the upload. Please try again later.

    I’m looking in my PHP console and don’t see any issues and none in my JS console either. Do either of you happen to know what this is about?


  • @rmdev that’s a good idea, I think I’ll go that route. I could also just use a conditional to test the page template and call the extra function if it’s true.

    If there are a lot of differences between the two headers, beyond just that one function call, your method is probably better. So far it’s only the function call for me.

    Thanks again guys! Thank you elliot for creating this plugin, it’s made web development so much more fun and streamlined.

  • OK, I think I figured it out. Basically I needed to put the acf_form_head() function call before my DOCTYPE was even declared, so I did that on my header.php file and not in the custom page template I created.

    I figured this out after trying to use the form to create a new post type and getting a whole bunch of PHP warning: Cannot modify header information.

    Just tried the same method with the standard front-end form that doesn’t create a new post type and it’s also working when acf_form_head() is called before DOCTYPE (or anything else). Seems obvious to me now but wasn’t clear from the tutorial section that it needed to be outside of the custom page template.

  • I’m looking into any differences with included scripts on the page but when I use typeof acf I get back "object" so it seems to be getting included properly.

    I’ll update with the scripts that are being included on the page.

    UPDATE: However, when I include jQuery myself (it looks automatically included from acf_form_head(); ) via a normal scrip tag, I get the Uncaught ReferenceError: acf is not defined.

    Very very strange

  • Hi all thanks for the responses!

    : I do have both of those fields, in fact I just copied the sample code from ( and it’s populating the page I put this code on with the correct fields. Do you have a file upload field working? That’s the only one I’m having trouble with, the Gallery field is indeed working for me now, just the file upload isn’t.

    : I’ll look into that and report back. It looked like all the JS was there but perhaps I missed something. I’ll look into using firebug to test that acf is an object.

    I’ll try to report back later today with an update.

  • Even more info!

    1. When the Library for the file is set to “Uploaded to post” the front-end form fails at line 50 of file.js: this.o.query.uploadedTo = acf.o.post_id; with the error Uncaught TypeError: Cannot read property 'post_id' of undefined | input.php:812
    2. When the Library is set to “All” that error is avoided but there is another error that occurs in file.js on line 138 title :, with the error Uncaught TypeError: Cannot read property 'file' of undefined | input.php: 900

    I’m not sure where to go from here

  • I’ve disabled all of the JavaScript I was including in my functions.php file so now I’m not getting any errors on page load and it looks like the scripts are getting added properly when viewing the page source.

    However, when I click the “add file” button for my uploader, I get an error in my JavaScript console:
    Uncaught TypeError: Cannot read property 'post_id' of undefined | input.php:812

    I checked that $post->ID is giving me the post ID, so that’s not the issue. Looking into it further.

    The Gallery field however, does work, but I need to do this for files, not images.

Viewing 11 posts - 1 through 11 (of 11 total)