php - Adding Custom post type title to attached images caption attribute in Wordpress -


i trying resolve issue friend of mine having image heavy wordpress site.

the site has multiple custom post types , each post type has custom fields allow multiple images uploaded.

the problem i'm trying solve this; site has around 40,000 images, of attached custom posts mentioned above, these images used showcase properties , combined preview pages show potential clients. locating correct images difficult , need add custom meta data images make them easier group/navigate.

ideally need add attachments parent post title alt or caption attributes every image on site.

theoretically done using default hook add_filter('foo... i'm not quite sure how structure can run through old images , future images.

a nudge in right direction appreciated.

wp_image_editor objects can perform operations on:

  1. wp_save_image_editor_file
  2. image_editor_save_pre
  3. wp_save_image_editor_file
  4. wp_image_editor_before_change

the first hook triggered when image edited (crop/re-size whatever)

the second 1 triggered when crop/rotate image , press save button (and it's pre-filter)

for 3rd 1 important note should use $image->save( $filename, $mime_type ); inside callback, or left image doesn't saved. , if want so, better don't return $saved no value/null.


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

thorough guide for profiling racket code -