Long running action from plugin

You could use WordPress’ pseudo-cron and wp_schedule_single_event. <?php // add the action. add_action(‘wpse71941_cron’, ‘wpse71941_long_running’); function wpse71941_long_running($args) { // might need to call `set_time_limit` here set_time_limit(0); // do long running stuff here // return normal time limit if($l = ini_get(‘max_execution_time’)) set_time_limit($l); } // schedule the event for right now wp_schedule_single_event( time(), ‘wpse71941_cron’, array(‘args’ => ‘for’, ‘callback’ … Read more

How can I save repeatable fields with one value inside an array?

You are saving only one image and one image caption. Your loop in dsslider_manager_save_extras function loops throught global $custom_meta_fields defined in php file. Not through $_POST variable. Your loop should look something like this: foreach ( $_POST[‘fields’] as $field ) { … } In HTML, the form should look like this <input type=”hidden” name=”fields[$field[ID]]” value=””/> … Read more

Set a User as Author of all ‘New Posts’ posted

function wp84782_replace_author( $post_ID ) { $my_post = array(); $my_post[‘ID’] = $post_ID; $my_post[‘post_author’] = 1 ; //This is the ID number of whatever author you want to assign // Update the post into the database wp_update_post( $my_post ); } add_action( ‘publish_post’, ‘wp84782_replace_author’ ); Update: This hook runs as the post is being published, not after, so … Read more

How is the WordPress.org plugin download history calculated?

I’ve answered a similar Question: Does the number of downloads displayed for a plug-in in the WordPress.org plug-in directory include automatic updates? This is Otto’s blog post in make.wordpress.org with plenty of information about this stats. Excerpts from the whole page (article and comments), worth reading in full: First, on the extend plugin directory, you … Read more

How to hide fields from my user profiles

Since there unfortunately indeed is no filter for this part of the profile, you have got two options, a hypothetically existing plugin aside: 1. Remove the fields with js (as is exemplified with the nickname field below) jQuery(document).ready( function($) { $(‘input#nickname’).closest(‘tr’).remove(); }); 2. Output buffer the generated markup and modify it before serving In absence … Read more

Moving image attachment from post to another?

As far as I know, you’d have to use a combination of built-in functions to achieve this. If there is a plugin, you’d have to research for “Bulk parent” or “Bulk re-attachment”. Unless you have a logic connecting those posts, I think you’d have to do it post by post. Be it with PHPMyAdmin (changing … Read more