Home › Toolset Professional Support › [Resolved] Relationships field isn't allowing us to add new authors
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)
Tagged: Setting up post relationship, Types plugin
Related documentation:
This topic contains 46 replies, has 3 voices.
Last updated by Beda 5 years, 5 months ago.
Assisted by: Beda.
The author's relationship field doesn't appear to be working.
On posts which have previously been assigned an author the box is present, but when you click 'Connect Existing Authors' it brings up the popup but that popup can't find any articles.
If it's a new article, then it simply replaces the authors block with an error message.
-----
We previously renamed the authors CPT to authors-cpt and wondered if that could be the reason?
Thanks,
Jack
Languages: English (English ) Spanish (Español )
Timezone: Europe/London (GMT+00:00)
Hi Jack
The second screenshot shows a message about technical difficulties and instructs you to check your inbox.
That looks like part of the new fatal error protection mechanism from WordPress alerting you to a fatal error when trying to retrieve related posts. Did you check your email? It will have given details of the error, or if you have debugging enabled you should be able to find details in your logs.
It sounds like changing the slug of a CPT used in a relationship is the likely cause, but can I get more details from you.
What where the slugs of the CPTs initially joined in the relationship?
What are they now?
How did you change them?
I recall testing this in the past and doing everything through the Toolset GUI the relationships continued to work okay, but there could be something specific that would prevent it from working, if you recall any pertinent details.
Hi Nigel,
We don't appear to be receiving the error message via our inbox (we did change the email account attached to the site after seeing that error message).
The slugs for the custom post type would've originally been author or authors (and they would've been the same when initially joined).
The slug has now been sent to 'authors-cpt', which was done through the Toolset GUI.
Thanks,
Jack
Languages: English (English ) Spanish (Español )
Timezone: Europe/London (GMT+00:00)
In your screenshot where you edit the relationship, no post type is selected for the parent. (Articles are selected for the child.)
Can you re-assign authors as the parent post type and see if that helps?
If not, check your debug logs if you didn't receive the email.
Hi Nigel,
How do I re-assign Authors?
Thanks,
Jack
Languages: English (English ) Spanish (Español )
Timezone: Europe/London (GMT+00:00)
Sorry, looking at your screenshots it appeared when editing the relationship you could select the post type for the parent which is currently empty, but trying that myself on a test site I see that you cannot.
I've looked in the database and think I've identified what the issue could be, but it requires you using a tool such as phpMyAdmin to edit the database directly, are you able to do that?
Before going any further you should make sure you have a current backup available.
You need to edit the content of the wp_toolset_type_sets table; you can see an example from my own test site in the screenshot.
Locate the entry for authors and change it to what is currently set as the slug of the post type, which you can confirm at Toolset > Post types when editing the post type. (I believe you will find this table entry has the original post type slug rather than the new one.)
I suspect that to be the cause and that this should fix it.
What I don't know is how it would have the wrong entry, because when I go to Toolset > Post types and edit the slug of a post type involved in a relationship, this table entry gets updated with the new slug automatically.
Can you try the above and let me know?
Hi Nigel,
They look to already be matching...
Screenshots attached.
Thanks,
Jack
Languages: English (English ) Spanish (Español )
Timezone: Europe/London (GMT+00:00)
And there are any other entries with the old slug that haven't been updated?
What looks a little odd to me is that the IDs in the two columns in your screenshot are identical, whereas browsing through my various test sites that's the case for none of them.
Anyway, I see two options for how to proceed.
First, you could delete the existing relationship, and make a new relationship between the required post types.
Whether that is a viable option depends on how many post connections you then have to set back up by editing posts and saving the connections.
If there are too many for that to be a viable option, then I'd need a copy of your site to test further and look for a solution. See hidden link about making a site copy available.
Let me know which of those you'd like to pursue.
Hi Nigel,
I understand from previous experience that the duplicator plugin doesn't work with our site due to how large it is.
We've got a dev server setup, can I provide you access to that instead?
Thanks,
Jack
Languages: English (English ) Spanish (Español )
Timezone: Europe/London (GMT+00:00)
Hi Jack
Let me set up a private reply for you.
If I can't identify the problem and need to involve a second tier colleague I may need a copy, but I'll cross that bridge as and when...
Languages: English (English ) Spanish (Español )
Timezone: Europe/London (GMT+00:00)
Hi Jack
I wasn't able to do much in your multisite environment but I did turn on debugging and checked the resulting debug logs.
You should be aware that it contains many errors relating to a "touchmain-search" plugin, e.g.
[17-Jul-2019 11:21:47 UTC] WordPress database error You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'FULLTEXT(title,content)' at line 1 for query ALTER TABLE wp_2_search_index ADD COLUMN FULLTEXT(title,content) made by require_once('wp-load.php'), require_once('wp-config.php'), require_once('wp-settings.php'), include_once('/plugins/touchmain-search/touch-search.php'), TOUCH_SEARCH_ADMIN_CLASS->__construct, TOUCH_SEARCH_ADMIN_CLASS->install, dbDelta [17-Jul-2019 11:21:47 UTC] WordPress database error Duplicate column name 'taxonomy' for query ALTER TABLE `wp_2_search_index` ADD taxonomy VARCHAR(255) NULL AFTER `content` made by require_once('wp-load.php'), require_once('wp-config.php'), require_once('wp-settings.php'), include_once('/plugins/touchmain-search/touch-search.php'), TOUCH_SEARCH_ADMIN_CLASS->__construct, TOUCH_SEARCH_ADMIN_CLASS->install [17-Jul-2019 11:21:47 UTC] WordPress database error Duplicate column name 'post_type' for query ALTER TABLE `wp_2_search_index` ADD post_type VARCHAR(255) NULL AFTER `content` made by require_once('wp-load.php'), require_once('wp-config.php'), require_once('wp-settings.php'), include_once('/plugins/touchmain-search/touch-search.php'), TOUCH_SEARCH_ADMIN_CLASS->__construct, TOUCH_SEARCH_ADMIN_CLASS->install [17-Jul-2019 11:21:47 UTC] WordPress database error Duplicate column name 'publish_date' for query ALTER TABLE `wp_2_search_index` ADD publish_date datetime NULL AFTER `content` made by require_once('wp-load.php'), require_once('wp-config.php'), require_once('wp-settings.php'), include_once('/plugins/touchmain-search/touch-search.php'), TOUCH_SEARCH_ADMIN_CLASS->__construct, TOUCH_SEARCH_ADMIN_CLASS->install
You really should investigate and fix those.
I'm not sure if they are connected to the reported issue in any way. While the plugin is active I was unable to see the expected error messages relating to the connection between articles and authors, but upon de-activating the plugin I could then see errors originating from Toolset:
[17-Jul-2019 11:26:37 UTC] PHP Fatal error: Uncaught TypeError: Argument 1 passed to Toolset_Association_Factory::create() must be an instance of Toolset_Relationship_Definition, null given, called in /srv/wp.0055.co.uk/public/htdocs/wp-content/plugins/types/vendor/toolset/toolset-common/inc/m2m/association/translator.php on line 89 and defined in /srv/wp.0055.co.uk/public/htdocs/wp-content/plugins/types/vendor/toolset/toolset-common/inc/m2m/association/factory.php:55 Stack trace: #0 /srv/wp.0055.co.uk/public/htdocs/wp-content/plugins/types/vendor/toolset/toolset-common/inc/m2m/association/translator.php(89): Toolset_Association_Factory->create(NULL, 6323, 207, 0, 262) #1 /srv/wp.0055.co.uk/public/htdocs/wp-content/plugins/types/vendor/toolset/toolset-common/inc/m2m/association/query/result_transformation/association_instance.php(76): Toolset_Association_Translator->from_database_row(Object(stdClass), Array) #2 /srv/wp.0055.co.uk/public/htdocs/wp-content/plugins/types/vendor/toolset/toolset-common/inc/m2m/association/query/result_transformation/associa in /srv/wp.0055.co.uk/public/htdocs/wp-content/plugins/types/vendor/toolset/toolset-common/inc/m2m/association/factory.php on line 55
I couldn't get much further, so I've taken a copy of this standalone site to be able to work on it locally (I was able to exclude many unrelated directories when generating the duplicate using Duplicator Pro).
I'm installing that now, and I'll update again when I've done some testing.
Languages: English (English ) Spanish (Español )
Timezone: Europe/London (GMT+00:00)
Spoke too soon, I installed the duplicate but much of the content related to post types is missing. I see that the theme adds a great deal of customisation, including registering and renaming post types, which may be related, and may explain why exporting the Types data from your site and importing them into my local copy failed to set-up many of the relationships with messages that the post types were missing.
I think I'll need to enlist the help of one of my second tier colleagues, but the first thing they are going to want done is for those errors in the logs I described above resolving before we can try and isolate and fix the problem with your relationships.
Could you please take a look at those and when you've managed to resolve the errors let me know and I will bring in a colleague.
Hi Nigel,
I've now fixed those PHP issues that you described - can this be passed along now?
Thanks,
Jack
Languages: English (English ) Spanish (Español )
Timezone: Europe/London (GMT+00:00)
OK, I'm going to have another stab at taking a copy of the site and installing it locally, and then will call on the cavalry if needed.
Languages: English (English ) Spanish (Español )
Timezone: Europe/London (GMT+00:00)
Hi Jack
Before trying to take a copy I went to add a new article so that I could see the issue you described and confirmed it is still present, and I noticed there were many JS errors in the browser console.
So I disabled the Types plugin to check if it was responsible for those errors, but the errors persist, the page is riddled with them, so much so that I'm surprised anything works at all.
See the screenshot.
That's without Types (or any other Toolset plugin) active.
There seems to be something fairly fundamentally wrong with your site, and we can't do much to assess possible problems with Types until the site works properly without it.