cron job to auto delete posts of a specific post type older than x days

// add the schedule event if it has been removed if( ! wp_next_scheduled( ‘mg_remove_old_entries’ ) ) { wp_schedule_event( time(), ‘daily’, ‘mg_remove_old_entries’ ); //run the event daily } // action hooked to fired with wordpress cron job add_action( ‘mg_remove_old_entries’, ‘mg_remove_old_entries’ ); function mg_remove_old_entries() { $posts = get_posts( [ ‘numberposts’ => -1, ‘post_type’ => ‘vfb_entry’, ‘date_query’ => … Read more

Remove all links to a specific website

You can use the Search Regex plugin. This will allow you to create a regular expression to intelligently search and replace across all of your posts. After you activate the plugin, go to Tools, Search Regex. If you want to remove all links to http://example.com, here is one regular expression you could try: /<a href=”http:\/\/example\.com[^>]*>([\s\S]*?)<\/a>/ … Read more

How to remove bulk edit options

A more reliable approach than messing with CSS would be to add some Javascript in the admin_head action, and basically override the built-in “inlineEditPost” function (located in wp-admin/js/inline-edit-post.js and easier to read in inline-edit-post.dev.js). I haven’t looked into it much specifically, but the brute force method would be to copy (and rename) that entire function … Read more

Custom bulk actions in WP 3.7.1

You’re seeing $action empty because there is a redirect from wp-admin/edit.php. So, the output you are seeing is after the redirect. Use, die() after echo $action to see the output before the redirect.

URL Redirect and Bulk Actions in wp_list_table

Understand hierarchy, You don’t need to redirect as form are posting values on same page. function process_bulk_action() { // Some security check code here // Get the bulk action $action = $this->current_action(); if ($action == ‘bulk_trash’) { // Code for the “delete process” $delete_ids = esc_sql($_POST[‘bulk-delete’]); //loop over the array of record ids foreach($delete_ids as … Read more

Is there a way to expose additional fields to the Bulk Action > Edit functionality?

A quick google search yielded these results for me: https://premium.wpmudev.org/blog/wordpresss-bulk-edit/ https://wordpress.org/plugins/custom-bulkquick-edit/ https://wordpress.org/plugins/tags/bulk-edit/ I am sure there is a way, but I do not think that there is a WP API for that (like options API or transients API, etc…). Maybe you can see what these free plugins are doing and how. Edit: I found the … Read more

How do I limit the status options for bulk/quick edit to only Published and Draft?

Answering this Question, came to a jQuery solution to Ana Ban’s one. add_action( ‘admin_head’, ‘wpse_56551_script_enqueuer’ ); function wpse_56551_script_enqueuer() { global $current_screen; /** /wp-admin/edit.php?post_type=post /wp-admin/edit.php?post_type=page /wp-admin/edit.php?post_type=cpt == gallery in this example */ if( ‘edit-gallery’ == $current_screen->id ) { ?> <script type=”text/javascript”> jQuery(document).ready( function($) { $(“a.editinline”).live(“click”, function () { var ilc_qe_id = inlineEditPost.getId(this); setTimeout(function() { $(‘#edit-‘+ilc_qe_id+’ select[name=”_status”] … Read more