WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I created a plugin and i need to use add_image_size in it.

I know how it work in the function file and for a theme, but how can i implement this in a plugin?

I want new images uploaded by wordpress users to be smaller for mobile with

add_image_size( 'wp_small', 60, 75, true ); //mobile

I read that you need to use init or admin_init but i don't know how to implement this.

share|improve this question
I just found the solution and wanted to post it here but i have to wait 8 hours to post it. – Gino Jun 7 '12 at 2:16

Just call this function in the init action. This action is fired for both frontend and backend. So it should look like this:

add_action( 'init', 'wpse4378_add_new_image_size' );
function wpse4378_add_new_image_size() {
    add_image_size( 'wp_small', 60, 75, true ); //mobile
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.