Strattic Developer Docs

Publish Action and Filter Hooks

During publish of your site, you may want to hook into the process in order to trigger other actions.

Path generation start

The following action hook fires very early in the publish process:

strattic_start_path_generation

As an example, you could hook into the action, count the posts and pages, and send that information to ElasticSearch (this is a sample class for the example) to save the data:

add_action( 'strattic_start_path_generation', 'collect_count_posts', 10, 1 );

function collect_count_posts() {
    $posts = get_count_posts();
    $pages = get_count_posts( 'page' );
    ElasticSearch::save_count_posts_and_pages( $posts, $pages );
}

More actions/filters to come…