Hey everyone
I am losing my mind a little here. I will try to keep it short.
* I am developing a custom theme for a client
* It’s mainly build up around ACF
* It’s a multisite and each subsite acts a language layer
* We are using subdomains, not a directory
* I am using local JSON with ACF
Everything was going great up until the point of having different slugs for the custom post types.
In order to store different custom slugs for each custom post type I have created a child theme, which then lets me store the the ACF JSON for that specific subsite in a different folder.
The idea is that all the subsites draws from the same main pool of ACF JSON, and if they need changes that are specific for that subsite, it gets stored and read separately.
**I achieve this in my child themes functions.php like this:**
add_filter(‘acf/settings/load_json’, ‘my_acf_json_load_point’);
function my_acf_json_load_point($paths) {
// remove original path (optional)
unset($paths[0]);
// Append the parent theme path
$paths[] = get_template_directory() . ‘/acf-json’;
// Append the child theme path
$paths[] = get_stylesheet_directory() . ‘/acf-json’;
return $paths;
}
add_filter(‘acf/settings/save_json’, ‘my_acf_json_save_point’);
function my_acf_json_save_point($path) {
// Set the path to save in the uploads directory specific to a site in the multisite network
$path = WP_CONTENT_DIR . ‘/uploads/sites/’ . get_current_blog_id() . ‘/acf-json’;
// Create the directory if it doesn’t exist
if (!is_dir($path)) {
mkdir($path, 0755, true);
}
return $path;
}
And this works. I can verify the changes through SFTP.
But then it gets weird…
After changing the slug (from /kurser/ to /courses/), the WordPress dashboard will still point to the slug (/kurser/ ) that is defined in the main folder for my ACF JSON (WordPress dashboard > MyCustomPostType > Click view on a post > [domain.com/kurser/post]) = 404).
However, if I manually enter the new slug, [domain.com/courses/post]) instead, the post will display correctly.
So, it seems to be working correctly, except within the WordPress dashboard. Menus will also still point to the old slug.
If I then go to and re-save my permalinks, [domain.com/courses/post]) starts redirecting to [domain.com/kurser/post]).
I suspect Rank Math SEO had a role in this, but the issue persists even after deactivating.
Any help or insight will be greatly appreciated!
​
[ad_2]