When is it too late to call the action wp_enqueue_scripts?

The function wp_enqueue_scripts— with an ‘s’– is used as a callback to wp_head. All that the function wp_enqueue_scripts does is fire the wp_enqueue_scripts action. So the last time that you would be able to use the action wp_enqueue_scripts is before the wp_enqueue_scripts callback on the wp_head hook. In terms of theme templates, that means you … Read more

Memory Leak in plugin action

Depending on what exactly you’re trying to achieve, I agree with Tom’s comment, that a WP-CLI command might be better. The advantage is that the command runs from php directly on the server (usually has no max execution time, loads different php.ini, etc.) and you don’t need to involve the webserver. If that is not … Read more

Add post thumbnail from external image with plugin

you should have a look to this blog post : http://www.maverick.it/tech/create-thumbnails-using-wordpress-built-in-functions then, if you can’t use a remote image, just download it as a temporary file on your server, process and delete it. One your image created, you should then insert it as an attachment (http://codex.wordpress.org/Function_Reference/wp_insert_attachment) and set it as the post thumbnail (http://codex.wordpress.org/Function_Reference/set_post_thumbnail) I … Read more

Plugin options table,is the data serialized

It totally depends on what data is being stored in the option, maybe_serialize will determine in the option is holding a singular static value, such as true/false, 0/1, empty string, whatever(it’s called when an option is created or updated).. it will serialize when dealing with objects and arrays, singular values are not serialized. The get_option … Read more