[Resolved] "Invalid post type" and "Invalid taxonomy" error
This thread is resolved. Here is a description of the problem and solution.
Problem: The client is experiencing issues with 'Invalid post type' and 'Invalid taxonomy' errors after attempting to translate custom post types and taxonomies using the 'Post Types Unlimited' plugin, which is not listed in WPML's compatible plugin directory. Solution: 1. Navigate to WPML > Settings > Post Type Translation. 2. Set the translation preference for the post types 'ptu' and 'ptu_tax' to 'Not Translatable'. 3. Go to the 'Post Types Unlimited' plugin, delete any translations of custom post types and taxonomies. 4. Clear your site's caches and check if the post types are now accessible. If the issue persists, we recommend replicating the problem in our sandbox environment to isolate the issue. You can access the sandbox here: WPML Sandbox Environment.
If these steps do not resolve the issue or if it seems outdated or irrelevant to your case, please open a new support ticket. We also highly recommend checking related known issues at https://wpml.org/known-issues/, verifying the version of the permanent fix, and confirming that you have installed the latest versions of themes and plugins. For further assistance, you can contact us directly through the WPML support forum.
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.
Background of the issue:
Hello, although I have followed the documentation on translating custom post types and taxonomies, something seems to be missing and I get the error of invalid post type or invalid taxonomy.
Symptoms:
Invalid post type and invalid taxonomy error
Questions:
What could be causing the 'Invalid post type' error?
What could be causing the 'Invalid taxonomy' error?
Are there additional steps for translating custom post types and taxonomies that are not covered in the documentation?
I understand the issue you're encountering. The errors related to 'Invalid post type' and 'Invalid taxonomy' usually point to problems with the registration or configuration of these elements in WordPress.
From the WPML debug information, I noticed several CPT and taxonomies on your site. Please ensure that the slugs for these CPTs are unique. Each CPT must have a distinct slug, and if you have translated the CPT's slug, the translated version must also be unique.
From the WPML debug info, I noticed that the "Post Type Unlimited" plugin is installed, and it seems you used this plugin to create the custom post types. It appears that the post type information stored by this plugin is set to be translatable. If you've translated the custom post type through this plugin, that might be causing the issue.
Please try the following steps to resolve the issue:
1. Go to "WPML > Settings > Post Type Translation."
2. Find the post type named 'ptu' and "ptu_tax" and set their translation preference to 'Not Translatable.'
3. Once done, go to "Post Type Unlimited," and if you have translated any custom post type, delete the translation. You also need to delete the translation of the taxonomies that you have created from Post Type Unlimited plugin.
4. Once done, clear the caches and check if you can now access the post type.
Let me know how it goes. I will be happy to help if you need further assistance in this matter.
First of all thank you for your immediate and enlightening support. I have proceeded up to step 2 (I found those "ptu" types and set them to 'Not Translatable.' However, how do I delete the translations only (I tried deleting the post types when I was in the English backend and I realised that all posts from both languages were sent to trash. Then I recovered them. But when I am on the "Greek" back-end (I see the Greek flag on the top admin bar), and I try visiting an item, it opens with the English flag on the top admin bar. In order to see the difference between the items (with the same names) I tried changing the names and values of a post type in Greek (Keynote Speakers). But now I see nothing in the list of the spedicic post type (. Chaned it back to english. Still nothing. So now I have this even more urgent issue.
Sorry to hear that you encountered issues after deleting the post types. Please restore a working backup to keep your site functional.
For your information, the "Post Types Unlimited" plugin is not listed in the compatible plugin directory (you can verify this here)of WPML. So, This could be a compatibility issue.
Could you please try to replicate the same issue in our sandbox environment? The autologin URL to our Sandbox is given below.
- hidden link
The WPML and its addons are already installed in the Sandbox. Please complete the setup of WPML. Once done, install the "Post Types Unlimited" plugin. Configure WPML and the Post Type Unlimited plugin just like on your main site, create a post type and check if you can recreate the issue in the Sandbox environment.
If you're able to replicate it on the sandbox, please let me know. I will take a look and try my best to solve the issue for you.
The Sandbox environment helps to test issues in a minimal environment so that we can easily trace the root cause of the issues.
Looking forward to your response and I'm always here to help.
I managed to proceed as follows:
1. I created a custom post type with my name in both English and Greek. It worked fine. It doesn't seem to be a matter of plugin conflict. Perhaps it has to do with the order of the steps I took to translate items. So this is still pending as an issue, I will explore it further as soon as I solve the next issue, which is more urgent.
2. Then I tried changing the name of the custom post type, and the post (with my name) disappeared from the list of posts, even if I changed it back to the original slug. HOWEVER this is still in the database, just like my posts with speakers on busart.org: in the front-end I see them perfectly. Only in the back-end they are absent.
Perhaps it has to do with the slugs and some disconnection/disassociation in the database?
Here is a short update about the disappeared posts. It seems I was renaming the slug back to a misspelled slug. In the original slug I was using an underscore.
So the main issue has to do with slugs and permalinks. At some points I get "internal server errors" when trying to visit a page. This gets solved if I change the permalinks and save them again (No matter what option I choose).
I observed that the permalinks choice is crucial. I have selected "Day and Name" (option 2) and it seems to be working. Is that what it should be?
Let me do my tests and examine if everything works ok and I will confirm shortly. Thank you once again for your time and patience. Just allow me some time to confirm that everything works and I will come back to mark my issue as resolved.
I am coming back for another "persistent" problem (in quotation marks because now it is gone and now it is back again!): I get the "Internal Server Error" whatever page I visit on the front end. When I switch the permanent link options, it starts working again. But after some time the "Internal Server Error" appears again.
The 'Internal Server Error' on the frontend typically occurs when a process on your site exceeds the server's resource limits. The root cause is usually recorded in the server error log. Could you please check the server error log to identify any potential issues? You can also share the log with us so that we can check further. If you don't have access to the server error log, please contact your hosting/server administrator to investigate the cause of the persistent server error.
Additionally, could you confirm if you're still experiencing the 'Invalid post type' issue? If so, let's discuss and address that in this ticket. To keep the thread clear and organized, please create a separate ticket for the other issue you mentioned in your last message, providing the requested details. Me or one of our support team members will take the ticket and assist you with that issue accordingly.