Select Page

J.E.D.I. Hooks & Filters

J.E.D.I. now offers some Hooks & Filters to allow developers to add extra functionality during the import process.

Hook: jedi_before_plugin_install
Fires before beginning installing repo plugins.
do_action( ‘jedi_before_plugin_install’ );

Hook: jedi_after_plugin_install
Fires after installing repo plugins.
do_action( ‘jedi_after_plugin_install’ );

Hook: jedi_before_import
Fires before beginning the import process.
do_action( ‘jedi_before_import’ );

Hook: jedi_before_media_import
Fires before importing Media.
do_action( ‘jedi_before_media_import’ );

Hook: jedi_after_media_import
Fires after Media have been imported, passes array of imported post IDs.
do_action( ‘jedi_after_post_import’, array $imported_media );

array $imported_media
An array of imported media IDs. The array index is the original Media ID, the value is new Media ID.
array $imported_media[$old_id] = $new_id;

Hook: jedi_before_post_import
Fires before importing Posts.
do_action( ‘jedi_before_post_import’ );

Filter: jedi_modify_post_content
Fires just before the Post is imported.
apply_filters( ‘jedi_modify_post_content’, $post_content );

Hook: jedi_after_post_import
Fires after Posts have been imported, passes array of imported post IDs.
do_action( ‘jedi_after_post_import’, array $imported_posts );

array $imported_posts
An array of imported post IDs. The array index is the original Post ID, the value is new Post ID.
array $imported_posts[$old_id] = $new_id;

Hook: jedi_after_import
Fires at the end of the import process.
do_action( ‘jedi_after_import’ );

EXAMPLE SCENARIO & CODE

On a recent child theme we used the Give plugin for donations and wanted the form to be included when the user imports the theme. We used the jedi_after_post_import hook to get the imported posts, search for the Give form shortcode, and then update the Post ID.

Here is the code that we added to the theme’s functions.php file…


Want more hooks and filters? Let me know!