Skip Navigation

This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 8:00 – 14:00 8:00 – 14:00 8:00 – 14:00 8:00 – 14:00 8:00 – 14:00 -
- 15:00 – 17:00 15:00 – 17:00 15:00 – 17:00 15:00 – 17:00 15:00 – 17:00 -

Supporter timezone: Europe/Madrid (GMT+02:00)

This topic contains 33 replies, has 2 voices.

Last updated by davidR-15 1 year ago.

Assisted by: Nigel.

Author Posts
March 15, 2024 at 10:27 am #15413833

davidR-15

I no longer can delete or update terms on my site.
When I try to delete a term, I get thousands (!) of lines of the same error message:

[15-Mar-2024 10:03:08 UTC] PHP Notice: Trying to get property 'post_type' of non-object in /var/www/domain.tld/wp-content/plugins/sitepress-multilingual-cms/classes/taxonomy-term-translation/class-wpml-term-actions.php on line 180

until the site bails out with a memory exhaustion error:

[15-Mar-2024 10:12:37 UTC] PHP Fatal error: Allowed memory size of 536870912 bytes exhausted (tried to allocate 20480 bytes) in /var/www/domain.tld/wp-includes/functions.php on line 7111
[15-Mar-2024 10:12:37 UTC] PHP Fatal error: Allowed memory size of 536870912 bytes exhausted (tried to allocate 20480 bytes) in /var/www/domain.tld/wp-includes/functions.php on line 625

I tried to delete a term because updating programmatically isn't possible anymore either. When I try to `wp_update_term` an existing term, I get a WP_Error saying

{"errors":{"duplicate_term_slug":["The slug “eag-groupes-fr” is already in use by another term."]},"error_data":[]}

March 15, 2024 at 3:45 pm #15415239

Nigel
WPML Supporter since 02/2016

Timezone: Europe/Madrid (GMT+02:00)

Hi there

Could you please share a screenshot from WPML > Settings of the Posts and pages synchronization section (I've shared an example here). It's the taxonomy settings I'm interested in.

Also, can you confirm how and where you are deleting terms, of which taxonomy?

Screenshot 2024-03-15 at 15.38.50.png
March 15, 2024 at 3:51 pm #15415257

davidR-15

It's a custom taxonomy and I'm trying to delete them using the regular WordPress UI. (From the list of terms, clicking "delete" below the term).

Settings-‹-Musée-national-d-histoire-naturelle-—-WordPress.png
March 15, 2024 at 4:50 pm #15415465

Nigel
WPML Supporter since 02/2016

Timezone: Europe/Madrid (GMT+02:00)

I've been trying to see how the notice could get triggered, but it's not obvious why.

The code that produces the notice is run when a term has been disconnected from a post it was assigned to. If you delete a term then that will involve that term being disconnected from posts it is assigned to, which will trigger the code that produces the notice.

But the notice occurs because there is no post.

Could I take a look at your site so I can see a concrete example of a term that is to be deleted, and I can see all the permutations of assignments and translations before attempting that?

Let me mark your next reply as private so that I can get log-in credentials from you—you may want to create a temporary admin user for me to use that you can later delete. And be sure to have a current backup of your site.

Please point me to a particular term to test with.

EDIT: Actually, before you do that, you could just try the two actions indicated in the screenshot from the page at WPML > Support > Troubleshooting (apply to the different post types the terms might be assigned to).

Screenshot 2024-03-15 at 16.51.43.png
March 15, 2024 at 5:18 pm #15415599

davidR-15

Actually, the site is much more broken that hat. I have e.g. terms in 3 languages that all show 223 connected posts, but when we click on the count, we get 0 posts.
There is something really broken here with the site that I wanted to debug by deleting a term, when I discovered that too wasn't working. Same with the programmatic update that is failing, probably for the same reasons.

I'll try the troubleshooting page options and will let you know.

March 15, 2024 at 5:35 pm #15415628

davidR-15

I've run both actions and the problems persist.

March 15, 2024 at 5:57 pm #15415817

Nigel
WPML Supporter since 02/2016

Timezone: Europe/Madrid (GMT+02:00)

Let me set a private reply again so I can take a look.

March 15, 2024 at 6:15 pm #15415863

davidR-15

I don't know if it's the only one, but the taxonomy I was referring to most of the time here is the "Age groups" one under Events.

March 18, 2024 at 11:02 am #15420474

Nigel
WPML Supporter since 02/2016

Timezone: Europe/Madrid (GMT+02:00)

Sorry, but the password doesn't seem to be correct, I cannot log in.

Could you please review, and edit your previous private reply to update the details?

Thanks.

March 18, 2024 at 11:06 am #15420509

davidR-15

Apologies, I didn't realize the password from my password manager was wrong. I corrected it in the private message.

March 18, 2024 at 3:22 pm #15422212

Nigel
WPML Supporter since 02/2016

Timezone: Europe/Madrid (GMT+02:00)

Thanks, that works now.

I can see a problem that if I click on the count (220) for the adults term of the age group taxonomy (to see the event posts that have the term assigned) it shows zero results, and via Query Monitor I can see why the query is returning zero results.

It includes a condition that ( 0 = 1 ) which clearly cannot ever be true.

But I can't see how that condition gets added very easily on your site.

Would it be okay to take a copy of your site to install locally, where I can more easily investigate and determine why that happens?

March 18, 2024 at 4:12 pm #15422522

davidR-15

What I find interesting is that filtering by `grand public` now works again… but you're right, `adults` still exhibits the same behaviour.

We are hooking into the queries a couple of time, but I can't find any that would do this straight away.

I'll check with my client whether they agree with a copy of the site.

March 19, 2024 at 4:01 pm #15427494

davidR-15

Hi Nigel, I got the customer's OK to clone the site.
Will you manage on your own or do you need any help from my side?

March 19, 2024 at 5:15 pm #15427905

Nigel
WPML Supporter since 02/2016

Timezone: Europe/Madrid (GMT+02:00)

OK, great.

Let me try, and if I can't for some reason I'll let you know.

(I'll do it first thing in the morning.)

March 20, 2024 at 10:29 am #15430392

Nigel
WPML Supporter since 02/2016

Timezone: Europe/Madrid (GMT+02:00)

I eventually managed to get a copy installed and working locally, but working only partially.

I don't see the post types and taxonomies from your site.

I guess they come from the MNHN Agenda and/or MNHN WP Login plugins, but I'm unable to activate either because of a fatal error.

Can they only be activated on your server?

In which case I'll have to work on there, but it will be more difficult to debug, and should really be done on a staging server.

If I need to use the production site, could you please ensure you have a current backup before I go any further.

The topic ‘[Closed] Trying to get property 'post_type' of non-object in class-wpml-term-actions’ is closed to new replies.