Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix compatibility with WP Stateless #11

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

ngxson
Copy link

@ngxson ngxson commented Jun 8, 2020

WP Stateless uses 'wp_update_attachment_metadata' hook, which is fired before 'wp_generate_attachment_metadata'. Therefore, when 'apply_watermark' is called, the local image files have already been deleted (and they are uploaded to Google Cloud).

Reference: https://github.com/wpCloud/wp-stateless/blob/v2.3/lib/classes/class-bootstrap.php#L236

This quick fix detects if we have WP Stateless plugin enabled, then switch to the correct hook.

Tested on Wordpress 5.4.1 + WP Stateless 2.3.2

ngxson added 2 commits June 9, 2020 01:04
WP Stateless uses 'wp_update_attachment_metadata' hook, which is fired before 'wp_generate_attachment_metadata". Therefore, when 'apply_watermark', the image files have already been deleted on local storage (and they are uploaded to Google Cloud).

This quick fix detects if we have WP Stateless plugin enabled, then switch to the correct hook.
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.

1 participant