Open GER32467 opened 5 months ago
Hi there We have the same issue on several sites so we want to give a bigger insight on why could happen. As we see the issue can be reproduced if these two plugins are active:
As soon as a custom field is added and linked to the job posttype and an existing job gets edited this error sometimes appears
Console Log looks like this then
POST https://xxxxx/wp-json/wp/v2/job-listings/26?_locale=user
500 (Internal Server Error)
Seems like it only happens if existing jobs get edited / duplicated (f.e. over yoast duplicate post plugin). New Posts that are created are not affected. Also if fields are added over code - not acf - it works fine.
Thanks for checking this
@thedebian any idea? Thanks for your help
@thedebian. Any idea or fix for this, I have same issue here. Thanks.
Hi there, Would you happen to have logs of the error happening on the server by any chance? (when you see the 500 happening)
@thedebian what i can see is in the server logs: Error 500 - POST /wp-json/wp/v2/job-listings/3382?_locale=user HTTP/1.0
https://eschercare.digicube.dev/wp-json/wp/v2/job-listings/3382?_locale=user
With all debug options enabled i can also see this in the console:
{
"code": "rest_meta_database_error",
"message": "Could not update the meta value of _filled in database.",
"data": {
"key": "_featured",
"status": 500
},
"additional_data": [
{
"key": "_filled",
"status": 500
}
],
"additional_errors": [
{
"code": "rest_meta_database_error",
"message": "Could not update the meta value of _featured in database.",
"data": {
"key": "_featured",
"status": 500
},
"additional_data": [
{
"key": "_filled",
"status": 500
}
]
}
]
}
I tested here and I could confirm that the issue seems to happy when a job is cloned using yoast duplicate post with a custom field added via ACF to the Jobs post type and using latest WPJM on a clean WP 6.6 site running PHP 8.3.
If you only clone a plugin without having the ACF custom field added it seems like it works fine. The same thing applies if you just have the ACF added to Job post type without cloning it. It's the combination that's breaking everything.
Checking at ACF's source code I couldn't identify anything that would conflict with WPJM, but this definitely does need more investigation to get fixed. Thanks for the report!
It is not just yoast duplicate post. It happens on any duplicate post plug-ins. On Jul 17, 2024, at 4:07 PM, Fernando Jorge Mota @.***> wrote: I tested here and I could confirm that the issue seems to happy when a job is cloned using yoast duplicate post with a custom field added via ACF to the Jobs post type and using latest WPJM on a clean WP 6.6 site running PHP 8.3. If you only clone a plugin without having the ACF custom field added it seems like it works fine. The same thing applies if you just have the ACF added to Job post type without cloning it. It's the combination that's breaking everything. Checking at ACF's source code I couldn't identify anything that would conflict with WPJM, but this definitely does need more investigation to get fixed. Thanks for the report!
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you modified the open/close state.Message ID: @.***>
@fjorgemota upon further checking here is what i was able to find.
1) a job gets created, thats how the database entries look from wpjobmanager
2) duplicate a job with yoast duplicate post - looks like this
So seems like entries are duplicated inside (_filled, _featured). When i try to save the job now with an ACF value set i get these errors:
When i went ahead and deleted 513 and 514 the post was able to be updated again without an issue.
Edit: maybe a link to their developer docs where you might have the chance to influence that this doesnt get copied: https://developer.yoast.com/duplicate-post/overview/
Looks like we are calling add_post_meta
with $unique = true
, which exits early if the meta key already exists. So I imagine it's WPJM adding the metas first, and then the Duplicate plugins adding the meta again regardless.
We could move adding the default metas to a later hook, like wp_after_insert_post
.
Right now this is called on wp_after_insert_post
:
And we have another one called on save_post
(via job_manager_save_job_listing
):
@yscik sounds good! If you have a PR ready let me know please - happy to help you guys test this. What will happen to all jobs that already have these duplicate postmeta entries? anything on your side so this can be cleaned? Would be great to make sure even existing jobs work again that were duplicated once.
@yscik any idea to fix this one? happy to test the PR
@masteradhoc We are still thinking about how to fix this properly in WPJM. Please give us more time.
In the meantime, feel free to include both _featured
and _filled
as meta fields for Yoast Duplicate Post to NOT duplicate on the Settings page, in Settings -> Duplicate Post, by informing both fields in a comma separated way:
Regarding the already duplicated posts, feel free to delete the duplicated meta fields for each duplicated post with the lowest meta_id
. Those are added by WPJM by default, before the Duplicate Post plugin adds the new meta fields with the value.
If possible, please use the "Duplicate Job" already present in the Job Dashboard (it is not available in wp-admin
), it also doesn't have this issue.
I hope this helps.
@fjorgemota any news on this? the issue still is here.
@masteradhoc Not yet. It's on the roadmap to be worked on in the future, but we don't have any specific deadline on when this will be worked on and released to the public, especially given that technically, the workaround above should work well, and that the "Duplicate Job" feature present in the Job Dashboard doesn't have this issue.
As mentioned on the docs here: https://wpjobmanager.com/document/getting-started/adding-jobs-via-admin/
Warning! Adding jobs via the backend, wp-admin dashboard is not recommended. This is because several verification steps are not taken when adding a job this way. WP Job Manager is designed in such a way that all jobs should be submitted via the frontend job submission form.
"Updating failed. Could not update the meta value of _filled in database." Continue to receive this error when updating jobs.