Category: Free Plugins

Multisite Post Duplicator – Actions and Filters

v06

For the latest version of my WordPress plugin (version 0.6) I have added various actions and filters to allow anyone to create addons or to extend the plugins functionality without having to edit the core.

Actions

‘mpd_before_core’ inc/core.php Perform actions just before duplication begins
‘mpd_during_core_in_source’ inc/core.php Just after data has been collected form source post but before we being to process the new post
‘mpd_end_of_core’ inc/core.php Immediately after all duplication actions have been performed
‘mpd_before_metabox_content’ inc/postform_ui.php Before the metabox markup is displayed
‘mpd_after_metabox_content’ inc/postform_ui.php After the metabox markup is displayed
‘mdp_start_plugin_setting_page’ in/settings-ui.php After settings page has been registered but before and settings fields have been generated
‘mdp_end_plugin_setting_page’ in/settings-ui.php After all core setting fields have been registered

Filters

‘mpd_activation_options’ mpd.php add/edit/delete the option fields added on activation of plugin
‘mdp_default_options’ mpd.php add/edit/delete the default values of each setting in mpd
‘mpd_is_active’ various locations change logic determining if plugin tools are available or not
‘mpd_setup_destination_data’ inc/core.php Hook into the post values for the destination post
‘mpd_returned_information’ inc/core.php add/edit/delete the information on the created post returned by the core function
‘mpd_ignore_post_types’ inc/mpd-functions.php Hook into the array which stores the post types that the mpd metabox will not display on.
‘mpd_featured_image’ inc/mpd-functions.php Filter details on the copied featured image
‘mpd_featured_image_filename’ inc/mpd-functions.php Do stuff with the copied featured image’s filename only
‘mpd_alt_tag_array_from_post_content’ inc/mpd-functions.php Do stuff with the alt tags for the images within the new post content
‘mpd_admin_notice_text’ inc/mpd-functions.php Hook into the ‘success’ admin notice.
‘mpd_global_filter_sites’ inc/mpd-functions.php Control the sites on your network that appear in the MPD functionality
‘mpd_show_settings_page’ inc/settings-ui.php Control the logic that determines when to show the Settings page
‘mpd_source_data’ inc/core.php Control the source data being added to the core duplication process
‘mpd_available_post_statuses’ inc/mpd-functions.php Control what post statuses are available to the user

Please note that this is a very brief summary of the filters and actions, for greater detail into parameters and data that you can gain access to with these hooks please check the source code.

More

Multisite Post Duplicator

Last post I mentioned a wee function I has written to help me with copying posts and pages from one multisite to another. Well I have packaged it into a plugin and submitted it to WordPress. After a few days I got notice that they approved it!

banner-1544x500

Check it out on GitHub also:

FireShot Capture - magicstickuk_multisi_ - https___github.com_magicstickuk_multisite-post-duplicator

It doesn’t finish here though. I have several ideas for future features. Stay tuned!

More

Correct Capitalisation of WordPress

So yesterday, when I wrote my first blog post on this site, I found myself having to go back to my post two or three times because I had noticed that I had used the incorrect capitalisation on the word ‘WordPress’. Should be a capital W and P.

So in my warped mind, tonight I decided to write a wee plugin that will auto fix this issue whenever I publish or update a post. It’s probably the most straightforward plugin you could hope to write but I like the exercise as you never know what you might learn on the way.

What I Did

In WordPress there is a Filter called wp_insert_post_data this filter basically allows you to intercept the POST data from when the user presses ‘Publish’ or ‘Update’ on the CMS and edit the data in any way you want BEFORE the data is added to the database.

The syntax for running this filter looks like this:

So in my function I have basically done a find and replace and returned the new data for WordPress to add to the database.

The Final Plugin:

Screen-Shot-2015-03-19-at-20.54.39

Download Now

More