Edit default image attachment size

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

Display one random image, but only if landscape

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

ACF attachment custom field in rest response

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’ );

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)