Excellent! This is working. Thanks so much!! No worries about deleting
Liferay, I'll take care of it.
I'll make sure to write a great review of your product. I really appreciate
it.
Hi Nicholas,
I have added a new file into your sites mu-plugins folder called: iwp-bidirectional-acf-relationship-field.php , this is to handle the custom bidirectional relationship updating for that importer.
I had some difficulty as you had modified it slightly, and in doing so i accidently wiped the employer text field for "Liferay", it currentlys says ["0","4049"]. this was due to me not knowing that the relationship field on Employers Profile was not called employer like it is on the Job Adder post type.
I would recommend trying it on a limited number of records / backing up the database to make sure it is fully working before doing a full import.
James
Thanks for those details, i will update you with what i find.
James
Hi Nicholas,
I have been racking my brain trying to figure out why the relationship field is working locally in a test environment using similar relationships between post types, but not on your website.
The only thing that i can think of is you have anything that alters the query, looking at your theme the only function i can see that does that is in your themes functions file called: fdds_cpt_search which is effecting all the search queries on your admin pages, e.g. searching on the Employers Profile or Job Adder section always returns nothing. Is this meant to happen or are you missing a !is_admin() in the if statement?
James
Hey James: I made that change to functions.php:270, and then ran the importer. Unfortunately, it still did not set the Employer value to "Liferay."
One improvement though: I can now manually set it to Liferay, after the import, and save it. Before, this would trigger an error message. Previously, I could only do this for Jobs not imported through ImportWP.
This error is caused by this line in your themes functions.php:270 (bacause no initial value has been imported and it was expecting a serialized array)
$value2 = get_field($field_name, $post_id2, false);
change it to
$value2 = (array)get_field($field_name, $post_id2, false);
Sure! I’ll try replacing it within the hour. Will let you know. Thanks for
your help!!
Liferay indeed exists already as an Employer: https://www.alariss.com/wp-admin/post.php?post=3610&action=edit
Thanks for sending over those details, i am now able to login.
I have just looked at the 3 "Job Adder".
It appears that they all have the employer "Liferay", which is a link to the employer profiles post type, this employer doesnt exist, this needs to exist for it to be linked in the relationship field.
James
By Any chance are you able to give my temporary access to your site so i can have a look at your importer settings, acf settings, the data that is trying to be imported, and the data thats trying to be linked.
James
I don't see a value here in the edit screen of the object. See attached. Is there a different way to view all of data for this object?
Hi,
If you run the importer, then go into the edit screen of the object that was just imported, is there a value in your relationship field matching that of the import (ignoring the bidirectional part)?
James
Hey James: Thanks for your response. I just tried the updated version again, but it did not work. Here is the error message that I receive, if I try to display the Employer Value in my html: "Warning: Invalid argument supplied for foreach() in /srv/disk1/3053074/www/alariss.com/wp-content/themes/alariss-astra-child/search-filter/results.php on line 65"
On the Custom Post page, it shows the Employer value as blank. However, if I then try to save the correct value, it shows the below error:
Warning: in_array() expects parameter 2 to be array, string given in /srv/disk1/3053074/www/alariss.com/wp-content/themes/alariss-astra-child/functions.php on line 281
Fatal error: Uncaught Error: [] operator not supported for strings in /srv/disk1/3053074/www/alariss.com/wp-content/themes/alariss-astra-child/functions.php:286 Stack trace: #0 /srv/disk1/3053074/www/alariss.com/wp-includes/class-wp-hook.php(288): bidirectional_acf_update_value_rel(Array, '3610', Array) #1 /srv/disk1/3053074/www/alariss.com/wp-includes/plugin.php(251): WP_Hook->apply_filters(Array, Array) #2 /srv/disk1/3053074/www/alariss.com/wp-content/plugins/advanced-custom-fields/includes/acf-hook-functions.php(101): apply_filters_ref_array('acf/update_valu...', Array) #3 /srv/disk1/3053074/www/alariss.com/wp-includes/class-wp-hook.php(286): _acf_apply_hook_variations(Array, '3610', Array, Array) #4 /srv/disk1/3053074/www/alariss.com/wp-includes/plugin.php(208): WP_Hook->apply_filters(Array, Array) #5 /srv/disk1/3053074/www/alariss.com/wp-content/plugins/advanced-custom-fields/includes/acf-value-functions.php(185): apply_filters('acf/update_valu...', Array, '3610', Array, Array) #6 /srv/disk1/3053074/www/alariss.com/w in /srv/disk1/3053074/www/alariss.com/wp-content/themes/alariss-astra-child/functions.php on line 286
The site is experiencing technical difficulties. Please check your site admin email inbox for instructions.
Set up:
Also, to link the two fields with an ACF relationship, I'm using the ACF bidirectional code (https://www.advancedcustomfields.com/resources/bidirectional-relationships/) , which saves the data as an array of Post IDs.
James: Thanks for the quick reply!
Hm, unfortunately that didn't work. I'm importing a Job Opening with the Employer field (Type: ACF Relationship) set as "Liferay." Unfortunately, after the import, it is still not matching the job to the Employer Post named "Liferay." Any ideas?
I'd like to import data for an ACF Relationship Field.
The prebuilt choices for Field Types are only "Text" or "Attachment." Is there a custom way to import data for ACF Relationship?
Thanks!
I am also trying to solve this issue. Could you please share the results? I am using an ACF Pro relationship field filtered by Post Type to select a page. My CSV that will be imported has the page title in it and I'd like for that page to be selected.