Import to gallery
-
Dear reader im trying to get a custom hook to work with importing image to a gallery.
the hook im using atm inside the function editor of the import is:
<?php // ---------------------------- // Gallery import // ---------------------------- function gallery_id_url($post_id, $att_id, $filepath, $is_keep_existing_images = '') { $key = 'vehicle_image_gallery'; // Edit this: Set meta key for gallery array here $size = 'full'; // Edit this: Set WordPress image size for the URL here (e.g. "full" or "thumb") $gallery = get_post_meta($post_id, $key, TRUE); if (empty($gallery)) { $gallery = array(); } if (!isset($gallery[$att_id])) { $src = wp_get_attachment_image_src($att_id, $size); $gallery[$att_id] = $src[0]; update_post_meta($post_id, $key, $gallery); } } add_action('pmxi_gallery_image', 'gallery_id_url', 10, 4); ?>
Screenshot of the import screen:
https://ibb.co/ky7CcwTCopy paste of value:
a:2:{s:3:”url”;s:78:”https://example.com/wp-content/uploads/2022/07/27395319-1.jpg”;s:2:”id”;s:4:”7469″;}i really hope you can help me out.
Thanks in advance,
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Import to gallery’ is closed to new replies.