FoPost LogoFoPost Docs
WordPress

Hooks

WordPress action and filter hooks provided by FoPost.

Hooks

The OwlStack WordPress plugin provides action and filter hooks for customization.

Actions

owlstack_post_published

Fires after a post is successfully published to a platform.

add_action('owlstack_post_published', function ($result, $post_id) {
    error_log("Post {$post_id} published to {$result->platform()->value}");
}, 10, 2);

owlstack_post_failed

Fires when publishing fails.

add_action('owlstack_post_failed', function ($result, $post_id) {
    error_log("Post {$post_id} failed on {$result->platform()->value}: {$result->error()}");
}, 10, 2);

owlstack_before_publish

Fires before publishing starts. Return false to cancel.

add_action('owlstack_before_publish', function ($post_id, $platforms) {
    // Log or modify behavior
}, 10, 2);

Filters

owlstack_post_content

Filter the content before it's sent to OwlStack.

add_filter('owlstack_post_content', function ($content, $post_id) {
    return $content . "\n\nRead more on our blog!";
}, 10, 2);

owlstack_post_platforms

Filter the platforms for a specific post.

add_filter('owlstack_post_platforms', function ($platforms, $post_id) {
    // Don't publish drafts to LinkedIn
    if (get_post_status($post_id) === 'draft') {
        $platforms = array_filter($platforms, fn ($p) => $p !== Platform::LinkedIn);
    }
    return $platforms;
}, 10, 2);

owlstack_post_hashtags

Filter the hashtags before publishing.

add_filter('owlstack_post_hashtags', function ($hashtags, $post_id) {
    $hashtags[] = 'mybrand';
    return $hashtags;
}, 10, 2);

owlstack_auto_publish_enabled

Control auto-publish per post.

add_filter('owlstack_auto_publish_enabled', function ($enabled, $post_id) {
    // Disable auto-publish for pages
    if (get_post_type($post_id) === 'page') {
        return false;
    }
    return $enabled;
}, 10, 2);

On this page