Aaaaaahhhhh… I didn’t customize the ACF dir. How embarrassing. It’s working perfectly now.
Thank you so much for your help!
It can’t exist at that URL.
http://localhost/fs/website_name/wp-content/plugins/Users/Storm/Sites/fs/website_name/wp-content/themes/theme_name/_includes/acf-pro/inc/datepicker/jquery-ui-1.10.4.custom.min.css?ver=5.0.8
As you can see above, the first part of the URL looks into the /plugins dir. Then the URL starts at /Users after that, which is the URL that $path
is returning with get_stylesheet_directory()
. It should wipe that whole URL and just start from http://
To see what was going with $path
, I tested the following:
$path = get_stylesheet_directory() . "/_includes/acf-pro/";
print_r($path)
returns
/Users/Storm/Sites/fs/swiftcarbon/wp-content/themes/swiftcarbon-theme/_includes/acf-pro/
$path = get_template_directory_uri() . "/_includes/acf-pro/";
print_r($path)
returns
http://localhost/fs/website_name/wp-content/themes/theme_name/_includes/acf-pro/
With get_template_directory_uri()
, there are no errors reported, so presumably it’s finding the files it needs, but then Custom Fields menu item disappears from the WP admin sidebar.
I am having the same problem, I’m including the plugin in my theme as below:
/* Include Advanced Custom Fields */
include_once("_includes/acf-pro/acf.php");
add_filter('acf/settings/path', 'my_acf_settings_path');
function my_acf_settings_path( $path ) {
// update path
$path = get_stylesheet_directory() . "/_includes/acf-pro/";
// return
return $path;
}
I have also tried get_template_directory_uri()
and get_bloginfo('stylesheet_directory')
.
The plugin is included and activated but I am getting 404 erros for the ACF stylesheets. This happens if (as above) I define the filter underneath the include function. If I put the filter above it then Custom Fields dissappears from the WP admin sidebar.
It works fine if I put the folder in plugins but this is not ideal.
Please help!
Hi Christian, thanks for getting back on this 🙂
I also just managed to get it to work by removing the $_POST['return']
line. So I ended up with this:
$post_id = wp_insert_post($post);
do_action( 'acf/save_post' , $post_id ); // Save the fields to the post
wp_redirect( add_query_arg( 'updated', 'true', get_permalink( $post_id ) ) ); exit; // Redirect to the new post
return $post_id;
you can also replace get_permalink( $post_id )
with a specific URL.
Bump. Also really need this.
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.