Programmatically Set First Image as Featured
Regarding the code you posted, I would say some things: you can avoid using 6 different actions because one is enough: ‘save_post’ is triggered everytime a post is created or updated you can drop globalize $post: ‘save_post’ will pass the post id, you can use it, in addition, preparing the function to receive an argument … Read more