Open dave3322 opened 3 years ago
Hi Dave! This is closely related to #576 (which is Jetpack's CDN). Keeping it open for now just to make sure our solution for that issue also fixes this issue.
Ok Thanbks - that issue [#576] has been open since 2016 though?
Considering there are about 4 different issues raised around this topic that have been open for up to 4 years my question / challenge to automattic developers is as follows.
Sorry to be direct, just wondering, as when i read the different issues raised, the contributors are always challenging the issue owner to explain the issue. which i understand. but considering the issue raised is around the same topic and has been raised a few times and is close to 4 years old, i would have thought one of the developers would look into this a bit as well as continue to challenge issue openers to explain the issue.
just my thoughts
Dave
Still no solution?
You can see my response in #1523
https://github.com/Automattic/WP-Job-Manager/issues/1523#issuecomment-693419838
@tripflex
Thanks for looking at this much appreciated. I am not a developer so I wont try and talk like one. but i do understand the basics when it comes to writing code and building a website and how things interlink. I believe the summary of what you are saying is that all the offload plugins have to do the work not wordpress or wpjm. I spoke to the plugin developers and they all said this is an issue with wpjm not their plugin. Especially around just the featured image.
Now lets us take two scenarios for showing images 1) an image gallery 2) the featured image
the image gallery works well with these cdn plugins (i.e insert a new gallery on the same page where the featured image disappears on edit). try and create a gallery with any cdn plugin. when you create the images they show on the front end, when you edit the gallery the images still show on the front end. and all urls are pointing to the cdn. This is with wpjm, wordpress and the existing infrastructure. This is their argument that the issue is not with all images on wpjm but the issue is exclusively on the featured image disappearing on edit.
featured image This does not work with the cdn and image disappears on edit.
suggested solution Can you look at the way the codeing, meta and all the developer type stuff you talked about and try and mirror the same codeding architecture that exits for the gallery images and do the same for the featured image?
Summary: if the gallery images work well with cdn, and the featured image dosent, then i can only conclude that this is an issue on the core codeing architecture and should not be fixed at plugin level.
Please let me know your thoughts
FYI 22 September 2020 - This is still an issue (WPJM featured image disappears on edit with using a cdn to host external images)
Hey @dave3322!
Since you're using it only for featured images, I think I have a solution for you. Could you try adding this snippet to your site, and confirm if it works properly?
I tested in a fresh env, using a similar setup to yours and it worked for me.
Sorry, I forgot the snippet:
add_filter( 'submit_job_form_fields_get_job_data',
function( $fields, $job ) {
if ( has_post_thumbnail( $job->ID ) ) {
$fields['company']['company_logo']['value'] = get_post_thumbnail_id( $job->ID );
}
return $fields;
},
10,
2
);
I came into this problem yesterday. Solution was to modify the output html buffer with str_replace to rewrite the CDN urls on the job listings form page back to the original urls so the hidden inputs for the existing media are not modified when the form is resubmitted
If you are using a CDN to host external images, the featured image or images originally added to the listing disappears.
The issue is when you want to edit the submission. If you click 'save' all seems fine, when you go to the front end and refresh the featured image disappears. I have tried with with two different CDN plugins
I think this issue is slightly different from wpjm rejecting external images on submission. This is wpjm rejecting external images on edit without displaying an error.
To replicate,
Download any CDN external image plug that changes the URL of your images so they are sourced from the CDN URL. I used 'WP Offload Media Lite' and also used 'Leopard - Wordpress offload media.
Turn all unecessary plugins off only the plugins that work with wpjobmanager'
Ensure you are running the latest version of wordpress 5.5.1
Create a listing with a featured image and submit
Go to front end and check. Featured image is there and if you inspect the URL of the image, it points to the CDN URL.
Now go back and click edit the listing, and just save, you don't necessarily have to make any changes, but click save again.
Now go back to the listing. Featured image disappears.
WordPress Environment