protection_method && 'page' === $restriction->replacement_type && is_page( $restriction->replacement_page ) ) || ( 'replace_archive_page' === $restriction->archive_handling && is_page( $restriction->archive_replacement_page ) ) ) { return $content; } /** * Filter the message to display when a post is restricted. * * @param string $message Message to display. * @param object $restriction Restriction object. * * @return string */ return apply_filters( $filter_name, $restriction->get_message(), $restriction ); } /** * Filter post excerpt when needed. * * @param string $post_excerpt The post excerpt. * @param WP_Post $post Post object. * * @return string */ public function filter_the_excerpt_if_restricted( $post_excerpt, $post ) { $filter_name = 'content_control/restricted_post_excerpt'; if ( doing_filter( $filter_name ) ) { return $post_excerpt; } // If this isn't a post type that can be restricted, bail. if ( protection_is_disabled() ) { return $post_excerpt; } if ( ! content_is_restricted( $post->ID ) ) { return $post_excerpt; } $restriction = get_applicable_restriction(); /** * Filter the excerpt to display when a post is restricted. * * @param string $message Message to display. * @param object $restriction Restriction object. * * @return string */ return apply_filters( $filter_name, $restriction->get_message(), $restriction ); } }