Skip Navigation

[Resolved] Taxonomy glitch

This support ticket is created 6 years, 10 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- - 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00
- - - - - - -

Supporter timezone: Asia/Ho_Chi_Minh (GMT+07:00)

This topic contains 24 replies, has 2 voices.

Last updated by Beda 6 years, 9 months ago.

Assisted by: Beda.

Author
Posts
#614728

Hello,

First, some background info:

I have a custom taxonomy for my travel website and something is not working properly. The way it is set is one main category and one sub-category like: Europe - UK, America - USA, etc

I have created categories for the continents and the countries as child categories.

Then, using a custom WordPress archive these display on the front end and are ordered by parent - Europe - UK

Problem

All was working fine with all the categories except for Asia and Oceania. For some reason, posts tagged with these categories weren't displaying the taxonomy in the right order. They were displaying (child-parent): UK - Europe

So, I thought this may have been caused by the order the terms were added to the system. Then, I went through the trouble of deleting the parent category (Asia) and all children categories (countries). After recreating them it worked out fine. Luckily I didn't have yet populated the custom fields of any of these children categories.

So, Asia was (is) now fine.

All I had left was Oceania. In this case I had already content in there, but I went through the trouble of deleting and creating the parent category (oceania) and children categories (Australia, New Zealand) but it didn't work.

I even created a category named "Oceaniaaa" and then a child named "aaaa" and it still didn't work.

I later created a category named "Category" and a sub-category named "category1" and the posts were displaying the taxonomy in the right order parent-child.

So, I ran out of ideas why this is happening just with this particular name or category?

I wonder if you could help me to detect what is causing this weird glitch.

Thanks and sorry for the lengthy explanation.

#614845

To help narrow this down, I need to have an example of this happening.

I tried to log in, but it says:

ERRO: A senha que inseriu para o nome de utilizador <> está incorrecta. 

Can you provide me the correct Password for this user?

I am replicating the package locally as well, but could you meanwhile ensure the correct log in data, and share with me where on the front end or backend I can see the issue?

Thank you!

#614848
#614854

Thanks.

I deployed the package but cannot log in, as the system redirects me to an HTTPS login URL and not HTTP.
I cannot figure out how you redirect this, as it's all set to HTTP in my server, wp-config.php and database options table.

I needed to disable all Plugins but Toolset to log in.

Additionally I saw that you use post-type-switcher plugin.
This plugin is inimitable with Toolset, it should be removed.
It breaks your parent/child relationships and more, if applied with Toolset.
I suggest to either remove it or be careful with mixing both plugins.

Right now, on the provided duplicator, the category Asia is empty.
As well Oceania is empty.

The Archive applied to these Taxonomies is ordered by Date of the post.

What do I need to do, to see the issue you mention?

#614860
breadcrumbs-right-order.png
breadcrumbs-wrong-order.png

Hi Beda,

Not sure what you mean. The site is https.

I used the post-type-switcher plugin to move from custom type to normal posts, but I don't need it anymore. I've disabled it now.

"Right now, on the provided duplicator, the category Asia is empty. As well Oceania is empty. " Yes, I've got no posts tagged with any of them, because these weren't working. But I've tagged one with Asia now and one with Oceania (screenshots attached for Asia - working fine and for Oceania - not working)

But if you create a new post or check the live site on the home page you'll see the issue. The issue is apparent on the breadcrumbs and elesewhere if I use the taxonomy for Oceania. I've created a dummy post and tagged it with oceania and a dummy child category.

Thanks.

#614863
Bildschirmfoto 2018-02-10 um 11.42.03.png
Bildschirmfoto 2018-02-10 um 11.40.40.png

I am speaking of the Duplicator package.
That is where I work on, as I need to find out why the single taxonomies are behaving differently.

I could not make the HTTPS/HTTP issue work, so I continued without the plugins (of course I left Toolset active).

I tagged one post each with Asia, Oceania, and each also a Child taxonomy term, as the original issue you describe is with the "ordered by parent"

This is not the case, as elaborated, the Archive is ordered by Post date.
You can see that in Toolset > WordPress Archives > Paises archive landing page
This seems the View Archive you use for those Taxonomies, correct?

In there, the ordering is by post date.
It cannot be by taxonomy term.

If I add a post to term "Oceania" I see it in that archive (see screenshot).

I added a subcategory "Test" to "Oceania" and this also displays the right "BreadCrumb" sequence (see screenshot)

The only thing that is different from my local to your online install by now is that I use only Toolset Plugins, no other Plugins.
The rest is exactly the same as in your install.

Can you test this somewhere without any other plugins?
This worked for me.

#614869

Hi Beda,

Thanks. Yes, I can see it is working for you. The issue is with breadcrumbs and when the taxonomy shows up via the breadcrumbs or via other form not the post dates and post ordering. Post ordering by date is fine.

In that archive you'll see I have order="parent" and it's working fine apart from Oceania, for some reason.

 <div class="grid-header-box">
							<span class="cat penci-cat-name">[wpv-post-taxonomy type="category" separator=""][wpv-post-taxonomy type="viagens" order="parent" separator="  "]</span>

This is also applied to the home page. But even on the post pages it's not working, so I don't think it has to do with this WP archive you mentioned.

Unfortunately I don't have other location to test it.

#614872

We need to test this without any other plugin, as I suspect, according my testes, the only difference is that I do not use those plugins.

What I can offer you is to test this on an online server of us, which is free, but you would need to populate it with your site (using a Duplicator as example).

Another inconsistency is that on your online site, there is no such taxonomy and post type as on the duplicator you sent.
It's deactivated.

I cannot debug this online, specially because this site seems under active development.

I would like to try as well, if the accent in Oceania has an effect.
It does not locally, but it might be that this is server dependent.

And I would like to see what happens when I re-save a post, and eventually the View, on the live site.

#614874

Hi Beda,

So, I deactivated all plugins except for Toolset and it still doesn't work.

"What I can offer you is to test this on an online server of us, which is free, but you would need to populate it with your site (using a Duplicator as example)." - I can do that

"Another inconsistency is that on your online site, there is no such taxonomy and post type as on the duplicator you sent.
It's deactivated."

What do you mean is deactivated? I only have one custom taxonomy and is activated.

"I cannot debug this online, specially because this site seems under active development." - I can open the site temporarily. That's not a problem at all.

"I would like to try as well, if the accent in Oceania has an effect." - I've tried different things even tried "Ocean" and it still doing the same thing.

Thanks.

#614880

On your site, the very post type is not active, you can see that when you head to Toolset > Post Types.
The Taxonomy is attached to that type, that type should hence one active.

May I create a sample set right there on that test site?
I would create all the things fresh, to see if that works and start from there to see why the current does not.

But I would need the test site you provided to be not altered a few hours.

#614882

"On your site, the very post type is not active, you can see that when you head to Toolset > Post Types.
The Taxonomy is attached to that type, that type should hence one active."

I was using a custom post type before but not any longer, since I no longer need it. I decided to use the WP posts and apply a content template instead. So the taxonomy doesn't need to be attached to that post type. But I don't see it attached to it when I log in.

"May I create a sample set right there on that test site?"
Yes. I will log out and won't make any changes and you could let me know when you're done.

I've created a couple of dummy posts with the problematic taxonomy, you can see those there as well.

I will log out now.

Thanks.

#614885

OK, got this.

In the site, right now, the "Oceania" term is used by one post.
This is visible in Dashboard > Posts > Viagens > Oceania.
This one post is visible on the archive:
hidden link

The sequence of breadcrumbs there is wrong.
It says "NOVA ZELÂNDIA OCEÂNIA" while it should be OCEÂNIA NOVA ZELÂNDIA.

This is output by the Code chunk here:

<span class="cat penci-cat-name">
  [wpv-post-taxonomy type="category" separator=""][wpv-post-taxonomy type="viagens" order="parent" separator="  "]</span>

The ShortCode you use does not support a order attribute of "parent".
It accepts acc and desc, nothing else:
https://toolset.com/documentation/user-guides/views-shortcodes/#wpv-post-taxonomy

I must have overseen this issue initially when you shared the problem with me.

This will not have any effect or supported feature, the attribute can only be as or desc.
Most likely, right now it falls back to the native 'order' => 'asc' coded in Toolset Views, and accidentally most of the terms display correctly in this order (by hierarchy).

When you choose "desc", it all works great (the breadcrumb is in the right sequence).

When you change this, the current wrong displays are corrected.

#614887
Screen Shot 2018-02-10 at 16.30.23.png
Screen Shot 2018-02-10 at 16.30.29.png

Hi Beda,

Thanks for the reply. I changed the "desc" to "parent" to fix the exact same problem. And since I added "parent" to that chunk of code it fixed the problem in all except for the Oceania.

If I change it back to "desc" then it works for oceania but breaks all the rest. You can try it on the archive ID 1771 for the homepage and see how it breaks all the breadcrumb order in the remaining posts. (see screenshots)

Thanks.

#614895

I tested this on your site with Oceania and Asia.
hidden link
hidden link

Now I see that it does not for hidden link, as example.

Now, the ShortCode order attribute accepts only two values:
asc, desc.

The code uses ksort() to sort the output.
This is a function that allows to sort alphabetically by key, but holding the array structure.

So for example, if you have an array array("d"=>"lemon", "a"=>"orange", "b"=>"banana", "c"=>"apple");, ksort() will output:
a = orange
b = banana
c = apple
d = lemon

This means for our case here, if you have a Parent and Child term structure, it will order them asc or desc alphabetically holding the structure, means first order the parents alphabetically then their Childs, separately.

This would result in something like this:
- A letter parent
-- A letter child
-- B letter child
- B letter parent
-- A letter child
-- B letter child

Etc.

And that seems to work just fine for some of your terms, not for others.

And I see now why this works on my local, but not on your site.
As I stated earlier, disabling all plugins made it work.

I suspect you use a Plugin to manipulate Terms.
See in the single Post edit screen for example:
hidden link
The Viagens taxonomy is clearly not native, it states that it made a child term to be "Primary".

That would then somehow match the problems we get on the front end - it changes the parent term.

Please try this again with no plugins. Eventually you need to reserve those posts, I am not sure how this specific feature is added to the posts, but it is not native to WordPress or Toolset, and it might interfere with what WordPress reads of it.

In fact, the posts that work fine have no such "primary" term

#614901

Hi Beda,

Well, but when I add "parent" it does have some effect because it clearly affects all the terms except oceania.

The taxonomy was created using Toolset. I don't have any other plugin installed to manipulate terms and I've deactivated all the plugins and created a new post and it doesn't work.

And that seems to work just fine for some of your terms, not for others.

"I suspect you use a Plugin to manipulate Terms."

I don't use any other plugin to create taxonomies except Toolset

"The Viagens taxonomy is clearly not native, it states that it made a child term to be "Primary"." I see what you mean, but I have no idea why the primary is showing up there." 🙁

Such a mystery. I'll disable plugins again and report back.