Jetpack_RelatedPosts::_enabled_for_request PHP Method

_enabled_for_request() protected method

Determines if the current post is able to use related posts.
protected _enabled_for_request ( ) : boolean
return boolean
    protected function _enabled_for_request()
    {
        // Default to enabled
        $enabled = true;
        // Must have feature enabled
        $options = $this->get_options();
        if (!$options['enabled']) {
            $enabled = false;
        }
        // Only run for frontend pages
        if (is_admin()) {
            $enabled = false;
        }
        // Only run for standalone posts
        if (!is_single()) {
            $enabled = false;
        }
        /**
         * Filter the Enabled value to allow related posts to be shown on pages as well.
         *
         * @module related-posts
         *
         * @since 3.3.0
         *
         * @param bool $enabled Should Related Posts be enabled on the current page.
         */
        return apply_filters('jetpack_relatedposts_filter_enabled_for_request', $enabled);
    }