Cropping an image before inserting into a post

I think you are good, but you don’t need to use other functions. You have all in File: wp-includes/media.php For instance, you may _wp_get_image_size_from_meta to get the image dimensions, so you don’t need to use something like this: $size = getimagesize($file); $width = $size[0]; $height = $size[1]; $mime = $size[‘mime’]; To get the image dimensions … Read more

Allowing post attachments without allowing to insert in text

One way to do this would be to simply hide the upload/insert media button: and, then add featured image support for your themes posts, so a user can still attach images to the post. Hide upload/insert media button for your theme in: functions.php: function hideUploadInsert($hook) { if($hook != ‘post.php’ AND $hook != ‘post-new.php’) return; // … Read more

Using Taxonomy Image code with my get_categories code

No luck by using plugin provided functions as it gets it’s id by $obj = get_queried_object(); To get the image I use this code snippet: $associations = taxonomy_image_plugin_get_associations(); $tt_id = absint( $taxonomy_term->term_id ); if ( array_key_exists( $tt_id, $associations ) ) { $image_id = absint( $associations[ $tt_id ] ); } $image = wp_get_attachment_image( $image_id, ‘thumbnail’ );

add data-attribute to all images inside the_content()

You will need to take a look at the image_send_to_editor filter. This will not update existing records but it if you get it working it will apply to each newly inserted image. very basic filter: function give_linked_images_class($html, $id, $caption, $title, $align, $url, $size, $alt=”” ){ $html; //contains the string you need to edit, you might … Read more

How can i alter the amount of different images sizes being stored?

Additional image sizes for uploaded images are created by wp_generate_attachment_metadata() after the file has been uploaded. An array of available sizes is populated using get_intermediate_image_sizes() (thumbnail, medium, large + custom sizes) which is later used to create the images. Both of the above functions have filters for overriding the sizes available to WordPress during this … Read more

Change website URL without breaking links or images? WP 3.3

There is a helpful codex article about moving WordPress: http://codex.wordpress.org/Moving_WordPress. Basically, you need to find/replace the DB for instances of your old domain, and swap them with your new domain. One additional trick I’ve learned when moving WordPress between environments: since WordPress stores the domain in several places as serialized data in the DB, you … Read more

Wrong domain in uploads folder

I will allow myself to expand on Ricks answer as there are a few ways to change old domain to new domain and each might be helpful depending on your situation. 1) use the Better Search and Replace plugin https://wordpress.org/plugins/better-search-replace/ plugin as suggested in the answer above. 2) use Database Search and Replace script https://interconnectit.com/products/search-and-replace-for-wordpress-databases/ … Read more