Hello,
I am using Elementor Pro and ACF with the Hello theme.
• I created a custom post type called ‘partitions’.
• For this custom post type, I created three taxonomies (‘instrumentation’, ‘formations’ and ‘compositeurs’).
• I created three taxonomy relation fields that I assigned to my custom post ‘partitions’, one for each taxonomy.
• For my three taxonomies, I also created a custom field called ‘Titre de la taxonomie’.
-> My purpose is to display in the template of my custom post type ‘partitions’ the taxonomy custom field ‘Titre de la partition’ for each taxonomy concerned : is it possible ? And how can I do that ?
Thanks o lot for helping
I was pumped to see 6.4.1 shipping with the option for custom tabs and custom icon groups in the Icon Picker field.
I was able to successfully get it to work on an Options page and in a custom taxonomy. However, custom tabs in the icon picker don’t load for me when assigning them to a block. The icon area just stays empty.
Has anybody had any luck with custom icons for the icon picker in blocks?
Hello, I will try to add ids to taxonomy on products woocommerce. What can I do?
Thanks!!
Hello
I have created a new custom post and a new custom taxonomy. When I go to add a new taxonomy to the new post, it selects all the categories automatically when saved, when I have only selected one.
Older categories and posts can be saved and categories added/removed ok, just these new post types and taxonomies.
Getting this error in the logs:
WordPress database error: [Duplicate entry ‘39067-0’ for key ‘PRIMARY’]
INSERT INTO term_relationships (object_id, term_taxonomy_id) VALUES (39067, 0)
Any ideas?
Hi,
I have two custom taxonomies but for some reason, within the backend of the CPT, I get no results when I filter one of the taxonomies. One is working, one is not showing results. Any ideas?
I have a question about ACF. I created an ACF group for a group of messages/lessons, which are also divided into subgroup lessons on addition, subtraction, multiplication, and division. I need to create a query from the ACF information that displays the lessons for the specific subgroups. I created a query for a particular taxonomy, but the sublessons don’t change for other categories. How do I make one in which the sublessons reflect the message category they belong to?
I have latest ACF pro and latest WordPress.
This happens on wordpress editor.
WordPress is trying to sanitize and escape fields that contain arrays instead of strings:
PHP Warning: Array to string conversion in /wp-includes/formatting.php on line 1096
[03-Mar-2025 20:40:11 UTC] ⚠ wp_check_invalid_utf8 received an array: Array
(
[genre] => Array
(
[0] => Array
(
[term_id] => 77
[slug] => dating-sim
[name] => Dating Sim
[parent] => 0
[term_taxonomy_id] => 77
[term_order] => 0
[facet] => {"term_id":77,"slug":"dating-sim","name":"Dating Sim","parent":0,"term_taxonomy_id":77,"term_order":0}
)
)
[index] => Array
(
[0] => Array
(
[term_id] => 1019
[slug] => i
[name] => I
[parent] => 0
[term_taxonomy_id] => 1019
[term_order] => 0
[facet] => {"term_id":1019,"slug":"i","name":"I","parent":0,"term_taxonomy_id":1019,"term_order":0}
)
)
[language] => Array
(
[0] => Array
(
[term_id] => 120
[slug] => english-patched
[name] => English Patched
[parent] => 0
[term_taxonomy_id] => 120
[term_order] => 0
[facet] => {"term_id":120,"slug":"english-patched","name":"English Patched","parent":0,"term_taxonomy_id":120,"term_order":0}
)
[1] => Array
(
[term_id] => 25
[slug] => japanese
[name] => Japanese
[parent] => 0
[term_taxonomy_id] => 25
[term_order] => 0
[facet] => {"term_id":25,"slug":"japanese","name":"Japanese","parent":0,"term_taxonomy_id":25,"term_order":0}
)
)
[publisher] => Array
(
[0] => Array
(
[term_id] => 7
[slug] => n
[name] => N
[parent] => 0
[term_taxonomy_id] => 7
[term_order] => 0
[facet] => {"term_id":7,"slug":"n","name":"N","parent":0,"term_taxonomy_id":7,"term_order":0}
)
[1] => Array
(
[term_id] => 109
[slug] => squaresoft
[name] => SquareSoft
[parent] => 0
[term_taxonomy_id] => 109
[term_order] => 0
[facet] => {"term_id":109,"slug":"squaresoft","name":"SquareSoft","parent":0,"term_taxonomy_id":109,"term_order":0}
)
)
[region] => Array
(
[0] => Array
(
[term_id] => 24
[slug] => japan
[name] => Japan
[parent] => 0
[term_taxonomy_id] => 24
[term_order] => 0
[facet] => {"term_id":24,"slug":"japan","name":"Japan","parent":0,"term_taxonomy_id":24,"term_order":0}
)
)
[release-year] => Array
(
[0] => Array
(
[term_id] => 2013
[slug] => 1987
[name] => 1987
[parent] => 0
[term_taxonomy_id] => 2013
[term_order] => 0
[facet] => {"term_id":2013,"slug":"1987","name":"1987","parent":0,"term_taxonomy_id":2013,"term_order":0}
)
)
)
[03-Mar-2025 20:40:11 UTC] 🔎 Function stack trace:
/wp-includes/formatting.php (Line: 4699) → Function: wp_check_invalid_utf8
/wp-includes/post.php (Line: 2989) → Function: esc_attr
/wp-includes/post.php (Line: 2833) → Function: sanitize_post_field
/wp-includes/class-wp-post.php (Line: 367) → Function: sanitize_post
/wp-includes/post.php (Line: 1116) → Function: filter
[03-Mar-2025 20:40:11 UTC] ⚠ wp_check_invalid_utf8 received an array: Array
(
[game_name] => Array
(
[0] => Array
(
[value] => Nakayama Miho no Tokimeki High School
[raw] => Nakayama Miho no Tokimeki High School
[boolean] =>
[date] => 1970-01-01
[datetime] => 1970-01-01 00:00:01
[time] => 00:00:01
)
)
[cdr_download_counter] => Array
(
[0] => Array
(
[value] => 6177
[raw] => 6177
[long] => 6177
[double] => 6177
[boolean] =>
[date] => 1970-01-01
[datetime] => 1970-01-01 00:00:01
[time] => 00:00:01
)
)
[rmp_vote_count] => Array
(
[0] => Array
(
[value] => 14
[raw] => 14
[long] => 14
[double] => 14
[boolean] =>
[date] => 1970-01-01
[datetime] => 1970-01-01 00:00:01
[time] => 00:00:01
)
)
[rmp_avg_rating] => Array
(
[0] => Array
(
[value] => 4.7
[raw] => 4.7
[long] => 4
[double] => 4.7
[boolean] =>
[date] => 2025-03-03
[datetime] => 2025-03-03 04:07:00
[time] => 04:07:00
)
)
)
[03-Mar-2025 20:40:11 UTC] 🔎 Function stack trace:
/wp-includes/formatting.php (Line: 4699) → Function: wp_check_invalid_utf8
/wp-includes/post.php (Line: 2989) → Function: esc_attr
/wp-includes/post.php (Line: 2833) → Function: sanitize_post_field
/wp-includes/class-wp-post.php (Line: 367) → Function: sanitize_post
/wp-includes/post.php (Line: 1116) → Function: filter
I’m using ACF custom posts to create dynamic loop grids in Elementor Pro. This all works correctly, but I’m having trouble setting display conditions for the custom taxonomies. There are certain things I want to show only if the current post in the loop grid is within a specific custom taxonomy.
I’m able to display the custom taxonomies with Elementor, and even use the Elementor taxonomy filter widget with the custom taxonomies, but display conditions is giving me some trouble.
Is there anyone else that has successfully been able to use display conditions with custom taxonomies that could help me out?
Hello, I have a field group within which I need some fields that conditionally display based on a specific value of a taxonomy on my post.
I believe that is not possible, and so I have created a new field group which clones many fields from my first group, and adds the additional ones required for my specific taxonomy. I can then conditionally display either my original field group, or my new ‘mostly cloned’ one if the specific taxonomy is chosen.
The problem is that I want to query one single field group name rather than having to duplicate my GraphQL. So that instead of having to query
group {
A
B
C
D
}
mostlyClonedGroup {
A
C
D
E
F
}
I can just query
group {
A
B
C
D
E
F
}
I have given the groups the same GraphQL Type Name but it will not allow me to access the new fields. So is this possible? If it isn’t, is there a better way to achieve the same thing? Thank you.
Hi all, I’m tinkering around with ACF but I’m a basic wordpress user.
I am trying to create a business directory of sorts with two custom post types.
I am getting this error when I create a new post in just one of the post types and try to add in the taxonomy.
“Cannot read properties of undefined (reading ‘toLowerCase’)”
Is there a way to fix this easily?
Probably sounds stilly but as I am at the very early stages of this project, I had tried to ‘start again’. I tried to delete the plugin and but even when I delete, clear cache / database, when I add plugin back in it still shows this error.
Thanks for any insight.
I am using ACF with Oxygen. I have one post type “product” and two taxonomies “store” and “collection”, both taxonomy has multiple custom fields. I have created an archive template, the same template applies to both the taxonomies i.e store and collection. I am using the below php function to return the taxonomy field value. The problem the field value of store is only visible on the stores archive page in the front end. and the field value of collection is only visible on the collection archive page in front end.
Both the archive page is suppose to display the products, the store name (i.e the store taxonomy custom field), collection name (i.e the collection taxonomy custom field).
How can i display the store fields on collections page and collection fields on stores page?
function get_tax_field($field_name) {
$term = get_queried_object();
return get_field($field_name, $term);
}
I have an ACF multiple taxonomy field to specify featured categories. I am looping over this field to get those categories and display them with a post count like this:
<?php
foreach ($featured_categories as $category) :
?>
<?php
endforeach;
?>
The issue I’m running into is that this is a shared taxonomy between two post types, so it is displaying the total post count across both of those post types. Is it possible to display the count based on a specific post type?
Hi, I am using a standard Gallery ACF field along with the Media Library Assistant plugin. Images uploaded to this gallery field have an associated taxonomy (Image Tags). To make life easier for the site’s admins who will be uploading lots of images and selecting lots of tags I was hoping I could add the Media Library Assistant’s taxonomy picker to the Gallery side panel.
At the moment once images have been bulk uploaded to a gallery a user has to click the Add to Gallery button again to open the Add Image to Gallery modal. Here on the right panel you can see the MLA plugin’s taxonomy list. But this isn’t a great user experience as it requires an extra click and the selected images in the modal are greyed out.
I know it’s possible from within ACF to create a Taxonomy field group and to select the location as [Attachment = All], but the experience isn’t as good as when using the MLA plugin. There’s no ability to add a comma separated list of new tags (there could be tens per image), nor swap between All Image Tags and Most Used.
So I was wondering if there were any hooks available to inject content into the gallery’s side panel, or any other type of solution I could use to try to get the side panel to display the MLA tag selector?
Thanks in advance.
Background: I’m using the classic editor and have disabled Gutenberg blocks and global styles.
I’ve created a custom post type named Resources, for which I’ve also created an archive archive-resources.php
.
I’ve created a Taxonomy Custom Field labeled Resource Type (name: res_type), which is linked to Resources and has a Radio Button appearance.
I’ve created a Taxonomy for my custom post type and custom field labeled Materials (the three options for materials are “Book,” “Course,” and “eBook”).
In my archive file, I’ve started the loop (if “…”, etc.), and in the loop, I am trying to display which Material was selected from the Taxonomy Custom Field in the Resource that was created.
Initially, I was trying to use the following code:
$res_type = get_field('res_type');
if ($res_type) {
echo '<h4 class="open-sans-lite resource-subtitle smaller-text">'.esc_html($res_type).'</h4>';
}
This code doesn’t work because if my Taxonomy Custom Field “Return Value” is set to ID, it only returns a number, and if it’s set to Object, it returns an error (please see images attached).
Instead, I tried this code:
$res_type = get_field('res_type');
if ($res_type) {
echo '<h4 class="open-sans-lite resource-subtitle smaller-text">'.esc_html($res_type->name).'</h4>';
}
However, this resulted in nothing at all in my HTML, not even an empty H4 element.
I’ve also been trying get_field_object()
to no avail.
Please help me understand how to retrieve the “Book,” “eBook,” or “Course” taxonomy that’s selected for their respective Resource when I target the Taxonomy Custom Field in the loop.
Hi there,
Yesterday, trying to change my permalinks using taxonomies, things went sideways quickly! I learned a tough lesson: I can’t just change the URL slug of a CPT nor can I change the Taxonomy Key. I did both 🙁
So now all my CPT archive pages and posts went 404 but the CPT posts (except for one CPT) are still there!!! That’s months of work I’m seeing in trouble and I’m super scared now that I do something to make it worse
I’m a simple website developer, already proud that I even got this far.
The website I’m working on is in staging. Another lesson learned, the usual backup doesn’t apply to the staging website so I lost all posts in this one CPT.
I assume they are lost forever, but I am desperate to know how I can protect my posts besides the usual backup.
Can I export the CPT posts and save them somewhere for them to import again in case a taxonomy breaks for whatever reason? Just to prevent days of work being lost :'(
Also, any advice on how to back up a staging website?
If anyone could help this damsel in stress, I would be very grateful.
Thanks ina advance,
Femke
Hi all,
I’ve searched on the forum and cannot find an answer to my question. So I hope someone can help me.
I have a post type called Technologies. In it I have posts that describe each technology that I have an interest in, and it becomes a landing page.
Here’s an example:
I have one post each for the following technologies:
AI
ChatGPT
LLM
I use these posts for landing pages such as:
example.com/technologies/ai
example.com/technologies/chatgpt
example.com/technologies/llm
Now, I want to associate these technologies with articles (using a post type articles) that I write regarding these technologies. I would rather not have a custom field call technology in these posts, because that means I have to manage these technologies in two places as I add or delete technologies that I want to write about.
Is there a way in my post type articles that can have the various technologies I have defined in my technologies post types?
I hope I’ve explained this correctly and clearly.
Thanks in advance.
Ben
Hi team,
I have a post_type = project
and a taxonomy for post_type = project_page
– Now I create a relationship name = taxpage_order for taxonomy project_page
how to: in project_page load current post_type = project of taxonomy
my code get current: post of taxonomy: but not true
function vnt_taxpage_order( $args, $field, $post_id ) {
$queried_object = get_queried_object();
if ( isset( $queried_object->taxonomy ) && $queried_object->taxonomy === 'project_page' ) {
$term_id = $queried_object->term_id;
$args['tax_query'] = array(
array(
'taxonomy' => 'project_page',
'field' => 'term_id',
'terms' => $term_id,
),
);
}
return $args;
}
add_filter( 'acf/fields/relationship/query/name=taxpage_order', 'vnt_taxpage_order', 10, 4 );
Any idea for my case?
Thanks team!
I submitted a ticket to what now seems to be WP Engine support to no avail, so will post here just in case!
I have a block called Link List, which well is just a list of links. It was a repeater for manually entered link items but it was updated to include existing site content as well. I seem to have successfully migrated the fields in the old repeater to the fields in the updated repeater, I can see them in block preview and when viewing the block on the front end. However, when editing the block, there are no populated fields to edit.
Old json – repeater field with three subfields (subhead, url, short_description):
{
"key": "field_64837282e5ad9",
"label": "Old Link List Items",
"name": "items",
"aria-label": "",
"type": "repeater",
"instructions": "",
"required": 0,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"layout": "block",
"pagination": 0,
"min": 0,
"max": 0,
"button_label": "Add Row",
"rows_per_page": 20,
"sub_fields": [
{
"key": "field_6483729ae5ada",
"label": "Old Subhead",
"name": "subhead",
"aria-label": "",
"type": "text",
"instructions": "",
"required": 1,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"default_value": "",
"maxlength": "",
"placeholder": "",
"prepend": "",
"append": "",
"parent_repeater": "field_64837282e5ad9"
},
{
"key": "field_64837357e5adc",
"label": "Old URL",
"name": "url",
"aria-label": "",
"type": "url",
"instructions": "",
"required": 0,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"default_value": "",
"placeholder": "",
"parent_repeater": "field_64837282e5ad9"
},
{
"key": "field_648372afe5adb",
"label": "Old Short Description",
"name": "short_description",
"aria-label": "",
"type": "textarea",
"instructions": "",
"required": 0,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"default_value": "",
"maxlength": 155,
"rows": "",
"placeholder": "",
"new_lines": "",
"parent_repeater": "field_64837282e5ad9"
}
]
},
New json – repeater with three sub fields (entry_method, custom_item, existing_item), the custom_item containing the original three item fields (subhead, url, short_description) from above.
{
"key": "field_66b4df4663782",
"label": "Link List Items",
"name": "link_list_items",
"aria-label": "",
"type": "repeater",
"instructions": "",
"required": 0,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"layout": "row",
"pagination": 0,
"min": 0,
"max": 0,
"collapsed": "",
"button_label": "Add Link Item",
"rows_per_page": 20,
"sub_fields": [
{
"key": "field_66b11540e682f",
"label": "Entry Method",
"name": "entry_method",
"aria-label": "",
"type": "select",
"instructions": "",
"required": 0,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"choices": {
"custom": "Custom URL",
"existing": "Existing Page Content"
},
"default_value": "custom",
"return_format": "value",
"multiple": 0,
"allow_null": 0,
"ui": 0,
"ajax": 0,
"placeholder": "",
"parent_repeater": "field_66b4df4663782"
},
{
"key": "field_6758a9a91df40",
"label": "Custom Link List Item",
"name": "custom_item",
"aria-label": "",
"type": "group",
"instructions": "",
"required": 0,
"conditional_logic": [
[
{
"field": "field_66b11540e682f",
"operator": "==",
"value": "custom"
}
]
],
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"layout": "block",
"sub_fields": [
{
"key": "field_6758a8101df3e",
"label": "Subhead",
"name": "subhead",
"aria-label": "",
"type": "text",
"instructions": "",
"required": 1,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"default_value": "",
"maxlength": "",
"placeholder": "",
"prepend": "",
"append": ""
},
{
"key": "field_66b4e13bd37ad",
"label": "URL",
"name": "url",
"aria-label": "",
"type": "url",
"instructions": "",
"required": 1,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"default_value": "",
"placeholder": ""
},
{
"key": "field_66b4e13bd37ae",
"label": "Short Description",
"name": "short_description",
"aria-label": "",
"type": "textarea",
"instructions": "",
"required": 0,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"default_value": "",
"maxlength": 155,
"rows": "",
"placeholder": "",
"new_lines": ""
}
],
"parent_repeater": "field_66b4df4663782"
},
{
"key": "field_66b1161ae6830",
"label": "Existing Link List Item",
"name": "existing_item",
"aria-label": "",
"type": "relationship",
"instructions": "",
"required": 0,
"conditional_logic": [
[
{
"field": "field_66b11540e682f",
"operator": "==",
"value": "existing"
}
]
],
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"post_type": "",
"post_status": "",
"taxonomy": "",
"filters": [
"search",
"post_type",
"taxonomy"
],
"return_format": "id",
"min": "",
"max": 1,
"elements": "",
"bidirectional": 0,
"bidirectional_target": [],
"parent_repeater": "field_66b4df4663782"
}
]
}
PHP – migrating the old item fields into new Link List Items > Custom Item
$old_items = get_field('items') ?: [];
$link_list_items = get_field('link_list_items', $post_id) ?: [];
if ($old_items) {
foreach ($old_items as $old_item) {
$is_duplicate = false;
foreach ($link_list_items as $existing_item) {
if (
$existing_item['entry_method'] === 'custom' &&
$existing_item['custom_item']['subhead'] === $old_item['subhead'] &&
$existing_item['custom_item']['url'] === $old_item['url'] &&
$existing_item['custom_item']['short_description'] === $old_item['short_description']
) {
echo '<p>Duplicate found:</p>
'; var_dump($old_item); echo '
';
$is_duplicate = true;
break;
}
}
// If not a duplicate, add to the new structure
if (!$is_duplicate) {
echo '<p>Adding new item:</p>
'; var_dump($old_item); echo '
';
$link_list_items[] = [
'entry_method' => 'custom',
'custom_item' => [
'subhead' => $old_item['subhead'],
'url' => $old_item['url'],
'short_description' => $old_item['short_description'],
],
'existing_item' => null,
];
}
}
echo '<p>New link_list_items array to update:</p>
'; var_dump($link_list_items); echo '
';
// Update the field with the current + migrated items
$update_result = update_field('link_list_items', $link_list_items, $post_id);
// // Check if the update was successful
if ($update_result) {
echo '<p>Field updated successfully.</p>';
} else {
echo '<p>Failed to update field.</p>';
}
}
Just to reiterate, after running the migration script I can now see the old field data in the new fields on the front end, but if I edit the Link List block it’s as if there is no content.
Any help troubleshooting this would be appreciated, thanks!
Hi there,
I run a community platform on buddypress pro with activated bbpress forum. The bbpress shortcodes [bbp-forum-index] returns all forums available. Unforunately there isn’t any shortcode available to display only one particular forum.
With ACF I have now created a Taxonomy called “business”. This taxonomy field is available for any forum. The idea was to workaround the missing shortcut issue by using a category. I thought that might help to display a particular form (the tiles, not the discussion string).
Can somebody advise how to do that?
thanks a lot.
Kain
Hello,
I am using acf_form() to display a form for creating a new post, in a modal on a custom admin page.
The form works fine, but when rendering the form, I need to populate one of the fields with a specific default value that is not the one defined for the field (because this new default value depends on some taxonomy of the new post).
It seems there is no way to transmit this value in the $settings array used by acf_form($settings) function. Is there a javascript hook used when rendering the form that I could use ? I searched but did not find.
Thanks in advance!
Etienne
Hey everyone, hoping you can lend some advice if possible. I’m pretty new to website development and coding, so am pretty out of my element here! This might be very easy to do, so apologise for my ignorance, but I’d appreciate the clarification/help if possible. Thanks in advance!
Basically, I’m building a website (using Elementor Pro) for a forthcoming magazine that’s going to publish several issues a year. There are going to be a number of Loop Items on the site that cycle through the magazine’s posts across various categories, and within each Loop Item template is a Post Info widget that ideally needs to list the author name, genre of post and the issue number that post can be found within. Obviously the first two are already present, but I figured I needed ACF to create the custom taxonomy of Issue Number.
Unlike the other taxonomies for author, genre etc., what I basically want to happen regarding this custom taxonomy is that, instead of triggering a query and taking you through to a filtered archive of posts at, e.g. ‘[website address].com/issue-number/issue-1’ etc., I want clicking on this issue number to actually take you to the direct product page where you can buy that issue, e.g. (in my case) ‘[website address].com/shop/standalone-issues/issue-1’. Is this viable, and if so, how would I go about implementing it? Much appreciated!
Hi all,
Would love some help on a website I’m currently building because I seem to not get something to work. The website has a custom post type ‘evenement‘. I have created a custom taxonomy ‘locatie‘ and last but not least I have made a Field group item ‘evenement_locatie‘, linked to the custom taxonomy.
I made a template for that show’s a single evenement post, that show’s the custom fields which I get with this code
<p><?php the_field("event_startdate"); ?><br> om <?php the_field("event_starttime"); ?></p>
This works fine for all fields, however I can’t seem to load the custom taxomony, and I tried all codes that I could find online. This is the code I’m currently using:
<?php
$term = get_field('evenement_locatie'); if( $term ): ?> <h2><?php echo esc_html( $term->name ); ?>test</h2> <p><?php echo esc_html( $term->description ); ?></p> <?php endif; ?>
And I have also tried
<?php echo get_field('evenement_locatie', get_queried_object()); ?>
Also tried to use the get_term function, but I can’t figure out how to get it working.
I also trying using get_field(‘locatie’) and that does not work as well.
My goal is to show the taxonomy title, and the description, but I’ve tried for hours now to get something. Also the WP_DEBUG is not giving me any error’s as well, so don’t know how to continue.
Any tips or tricks?
Thanks in advance!
Post Types:
Desired URL Structure:
I’d like to display the chapter
post type under the book
post type in the following structure:
What I’ve Tried:
book
and chapter
post types using ACF. I added a rewrite rule in my theme to achieve the desired URL structure.Result: The URL didn’t return a 404 error, but it didn’t resolve to the chapter page. Instead, it redirected to the book page. For example:
The Problem:
How can I correctly set up this URL structure using ACF to:
Any guidance or example code would be greatly appreciated!
Hi,
I’m maintaining a WooCommerce site for a client who had a different developer set things up originally. Currently running WordPress version 6.6.2, WooCommerce version 9.3.3, and ACF Pro version 6.3.10. The previous developer set up a field group to provide some additional filtering options for products in certain categories (custom taxonomies). This worked fine for quite some time, but at some point, this field group stopped showing up on the backend when creating or editing products.
For the field group, the location rules were set to show these fields when “post type = product”, and “post taxonomy = specified category”. If I remove the “post type = product” criteria, the fields show up.
I have no idea why the previous dev set both these criteria, and I *could* simply remove the “post type = product” rule from the location rules, but I’d rather find out what went wrong to cause this to stop working.Any tips on where to start would be greatly appreciated.
thanks!
I’ve an interesting challenge (can’t be a problem, it has to be possible to solve it).
I’m trying to sort an archive page on title, using an ACF taxonomy.
I tried it with the following code snippet:
add_action( 'pre_get_posts', 'new_sort_order');
function new_sort_order($query){
global $wp_query;
if (is_archive() && is_post_type_archive('card') ):
//Set the order ASC or DESC
$query->set( 'order', 'ASC' );
//Set the orderby
$query->set( 'orderby', 'title' );
endif;
};
‘card’ is also an ACF post type.
It does not work. When I remove the ‘is_post_type_archive’ it does, but then it sorts every archive page of every post type on title. That’s not the idea.
So I delved a bit deeper into the query, and I see the ‘is_post_type_archive’ function checks against the ‘post_type’ field of the global $wp_query, and the value of that field is ‘acf-taxonomy’.
So is there a way to retrieve the post_type value (‘cards’) from the query?
Thanks in advance
Wilko