helpful/shortcode/disabled

This hook allows you to disable Helpful shortcodes for certain posts. This is especially useful if you want to exclude certain content based on certain meta fields or options.

In our example, we make sure that the post with ID 12345 is excluded from Helpful and no Helpful is shown anymore.

/**
 * @param bool $status
 * @param WP_Post $post
 *
 * @return bool
 */
add_filter('helpful/shortcode/disabled', function (bool $status, WP_Post $post) {
    $post_id = 12345;
    return (isset($post->ID) && $post_id === $post->ID) ? true : $status;
}, 10, 2);

Was this post helpful?

Top