Skip to content

Instantly share code, notes, and snippets.

@asharirfan
Last active June 3, 2019 09:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save asharirfan/8e9a3f18c45d32c56bf2e82917017e0e to your computer and use it in GitHub Desktop.
Save asharirfan/8e9a3f18c45d32c56bf2e82917017e0e to your computer and use it in GitHub Desktop.
Clear the file changes notifications of WFCM plugin on activation.
<?php
/**
* Plugin Name: WFCM Clear Notifications
* Plugin URI: http://www.wpwhitesecurity.com/
* Description: Clear the file changes notifications of WFCM plugin.
* Author: mrasharirfan
* Contributors: WP White Security, mrasharirfan
* Version: 1.0
* Text Domain: wfcm-clear-notifications
* Author URI: https://asharirfan.com/
* License: GPL3
*
* @package wfcm-clear-notifications
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
/**
* Clear WFCM notifications.
*/
function wfcm_clear_notifications() {
$wfcm_events = get_posts(
array(
'post_type' => 'wfcm_file_event',
'post_status' => 'private',
'posts_per_page' => -1,
)
);
if ( ! empty( $wfcm_events ) ) {
foreach ( $wfcm_events as $wfcm_event ) {
wp_delete_post( $wfcm_event->ID, true );
}
}
}
add_action( 'init', 'wfcm_clear_notifications' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment