How to insert a local image with custom size

add_image_size function has nothing to do with the images that are located in theme root directory. When you add add_image_size function , we are saying that : Hey WordPress! Can you please also re-size my uploaded images via WordPress admin to this particular size also hard crop the image if image size is bigger ( … Read more

Assign a picture URL to a page via PHP

You can use the add_post_meta function: add_post_meta( get_the_ID(), ‘my_custom_image_url’, ‘http://domain.com/image.jpg’, true ); The code above assumes that a) you will have only one image per page; and b) you are in a loop so get_the_ID will return a valid ID of the page you want to attach the meta-data to. Documentation here.