The critical finding: EME’s hook system fires based on database operations, not file system operations. When a frontend form submits an event with an image, the sequence is: (1) form data validation, (2) event inserted into database with event_image_id reference, (3) eme_insert_event_action fires, E-dynamicsE-dynamics (4) WordPress processes image upload asynchronously. E-dynamics This means hooks execute while images may still be uploading or generating thumbnails. WordPress Since EME version 1.0.16, the plugin uses WordPress’s featured image system exclusively rather than custom image handling, GitHubGitHub eliminating any EME-specific image hooks. GitHubGitHub The event_image_id field stores the WordPress attachment ID, GitHub but the actual image file and metadata may not be ready when your hook function executes.
Priority 20 works as a practical baseline because it delays execution after EME’s internal processing (priority 10), Stack Overflow giving WordPress time to complete basic attachment operations. Stack ExchangeRip Tutorial However, this is community convention, not documented EME behavior. For complex image operations like optimization or external API calls, priorities 30-50 provide safer timing margins.
Location: Milk & Beans