Skip to content

Add WebP support and dedicated filter for company logo uploads#2933

Open
masteradhoc wants to merge 3 commits intoAutomattic:trunkfrom
masteradhoc:2932-webp
Open

Add WebP support and dedicated filter for company logo uploads#2933
masteradhoc wants to merge 3 commits intoAutomattic:trunkfrom
masteradhoc:2932-webp

Conversation

@masteradhoc
Copy link
Contributor

Fixes #2932

Changes Proposed in this Pull Request

  • Added webp as a default allowed mime type for company logo uploads
  • Added job_manager_company_logo_allowed_mime_types filter so developers can customize allowed mime types for company logos without affecting other file fields
  • Applied the same filter to both the form validation path and the Ajax uploader path (job_manager_get_allowed_mime_types()) so they stay in sync
  • Fixed the frontend Ajax upload preview not showing an image thumbnail for .webp files

Testing Instructions

  • Submit a job listing and upload a .webp file as the company logo — it should upload successfully and show an image preview
  • Confirm non-image file types still trigger the correct error
  • Add the filter below and confirm a custom type (e.g. SVG) is accepted in both the drag-and-drop Ajax uploader and on form validation:
add_filter( 'job_manager_company_logo_allowed_mime_types', function( $types ) {
    $types['svg'] = 'image/svg+xml';
    return $types;
} );

Release Notes

  • Company logo uploads now accept WebP images by default
  • New filter job_manager_company_logo_allowed_mime_types allows customizing allowed file types for the company logo field

New or Updated Hooks and Templates

  • Filter: job_manager_company_logo_allowed_mime_types — Filters the allowed mime types for the company logo upload field. Applies to both the form validation and the Ajax file uploader. Receives an array of extension => mime_type pairs. Note: the form validation path uses plain extension keys (e.g. 'webp'), while the Ajax uploader uses pipe-separated keys (e.g. 'jpg|jpeg|jpe') — both are passed through this same filter.

Deprecated Code

Screenshot / Video

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add webp support to WPJM

1 participant