LogoLogo
WordPress.orgExtensionsSupport
Version 9
Version 9
  • Notification – Custom Notifications and Alerts for WordPress
  • Updating to v9
  • Known issues
  • πŸ€Έβ€β™€οΈ User guide
    • Update broke my site
    • How Notification plugin works
    • Who can use this plugin
    • How to create Notifications
    • Troubleshooting
    • Advanced
      • How to escape { character
      • Background processing
      • How to setup different FROM address for different Notifications
      • Custom Post Type support
      • Disable upselling
      • How to send HTML Emails
  • πŸ”§Developer
    • General
      • Plugin loading chain
      • Runtime
      • Extension possibilities
      • Creating an extension
      • Customizations
      • Bundling Notification plugin
      • White label mode
    • Notifications
      • Suppressing the Notification
      • JSON synchronization
      • Programmatic Notifications
    • Triggers
      • List of all default Triggers
      • Custom Trigger
      • Enable support for non-public Custom Post Type
      • Adding Merge Tags to existing Triggers
    • Carriers
      • Custom Carrier
      • Adding custom fields to Carrier form
      • Suppressing the Carrier
    • Recipients
      • Custom Recipient
    • Snippets
      • General
        • Automatic Trigger testing
        • Allow other roles to edit Notifications
        • Programmatic Notification with manual Trigger
        • Background Processing filter
      • Triggers
        • Post
        • User
      • Integations
        • WP All Import
        • MemberPress
  • 🧩Extensions
    • Installation
    • Planned extensions
    • 3rd Party Extensions
    • Custom Fields
      • v2.2
      • v1.4
      • v1.3
    • Conditionals
    • Email Attachments
    • Push
    • Scheduled Triggers
    • Slack
    • Twilio
    • Webhooks
Powered by GitBook
On this page

Was this helpful?

  1. Developer
  2. Snippets
  3. Integations

WP All Import

Importing posts

By default, WP All Import plugin will trigger the actions twice for each post imported.

This guide assumes that you have the option "Increase speed by disabling do_action calls in wp_insert_post during import." checked, in the Import settings in Advanced Options tab.

You must use Post added trigger for this integration (or other Custom Post Type added trigger) or Post updated trigger.

// Add our proxy action to the trigger.
add_action('notification/trigger/registered', function($trigger) {
    if (preg_match('/post\/(.*)\/added/', $trigger->getSlug())) {
        $trigger->addAction( 'notification_pmxi_added_post', 10, 3 );
    }

    if (preg_match( '/post\/(.*)\/updated/', $trigger->getSlug())) {
        $trigger->addAction( 'notification_pmxi_updated_post', 10, 3 );
    }
} );

// Proxy action.
add_action( 'pmxi_saved_post', function( $post_id, $node, $is_update ) {
    if ( ! $is_update ) {
        do_action( 'notification_pmxi_added_post', $post_id, get_post( $post_id ), false );
    } else {
        do_action( 'notification_pmxi_updated_post', $post_id, get_post( $post_id ), get_post( $post_id ) );
    }
}, 10, 3 );

// Disable postponing.
add_filter( 'notification/integration/gutenberg', function( $initial ) {
    if ( defined( 'WP_IMPORTING' ) && WP_IMPORTING ) {
        return false;
    }
    return $initial;
} );

add_filter( 'notification/integration/custom_fields/should_postpone_save_post', function( $initial ) {
    if ( defined( 'WP_IMPORTING' ) && WP_IMPORTING ) {
        return false;
    }
    return $initial;
} );
PreviousIntegationsNextMemberPress

Last updated 6 months ago

Was this helpful?

πŸ”§