Reorder “menu order” of attachments to another predefined order
Reorder “menu order” of attachments to another predefined order
Reorder “menu order” of attachments to another predefined order
How to make a customized “Create Gallery” tab in the ‘Add Media’ window?
Perform a custom (bulk) action in media view
you can try this function filter_ptags_on_images($content) { $content = preg_replace(‘/\s*()?\s*()\s*()?\s*/iU’, ‘\1\2\3’, $content); return preg_replace(‘/\s*(*.)\s*/iU’, ‘\1’, $content); } add_filter(‘the_content’, ‘filter_ptags_on_images’); this also has been solved here remove p tags from images
after 3 days i found the problem was because of an space in end of urls in $imgList array (Except last url) !!! so i added trim for each url ($value) and solved problem … <?php $img = get_post_meta( get_the_ID(), ‘pics’, true); $imgList = explode(“\n”, $img); $attach_ids = array(); foreach ( $imgList as &$value ) … Read more
Issue to get wp_get_attachment_image with cmb2
ok, following the comments: //from https://stackoverflow.com/questions/37537577/wordpress-query-by-attachment-meta-image-size add_filter(‘wp_generate_attachment_metadata’, ‘add_metac’, 10, 2); function add_metac($meta, $id){ update_post_meta($id, ‘height’, (int) $meta[‘height’]); update_post_meta($id, ‘width’, (int) $meta[‘width’]); update_post_meta($id, ‘ratio’, round ($meta[‘width’] / $meta[‘height’] , 2 )); return $meta; } at this point you will have, for the newly uploaded images, in the postmeta table all the information and a ratio >1 … Read more
Check out ACF to REST API – https://github.com/airesvsg/acf-to-rest-api You can optionally turn on/off which fields you want to enable. // Enable the option show in rest add_filter( ‘acf/rest_api/field_settings/show_in_rest’, ‘__return_true’ ); // Enable the option edit in rest add_filter( ‘acf/rest_api/field_settings/edit_in_rest’, ‘__return_true’ );
your query looks good and seems workning. I’ve made a test on my database and the image remained visible in the media library after the ID change. Maybe there was already other posts existing with that IDs
Once you already have the attachment ID, you can get the full path with get_attached_file: $image_path = get_attached_file( $attachment_id );