Skip to content

Commit

Permalink
Related Posts: check for any single post without regard for post type. (
Browse files Browse the repository at this point in the history
  • Loading branch information
kraftbj authored Oct 11, 2024
1 parent 566c56a commit bf52578
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
4 changes: 4 additions & 0 deletions projects/plugins/jetpack/changelog/add-rp-support-on-pages
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: minor
Type: compat

Related Posts: allow Related Posts on non-post CPTs where the block is already able to be used.
Original file line number Diff line number Diff line change
Expand Up @@ -1883,18 +1883,19 @@ protected function log_click( $post_id, $to_post_id, $link_position ) { // phpcs
/**
* Determines if the current post is able to use related posts.
*
* @uses self::get_options, is_admin, is_single, apply_filters
* @since $$next-version$$ Checks for singular instead of single to allow usage on non-posts CPTs.
* @uses self::get_options, is_admin, is_singular, apply_filters
* @return bool
*/
protected function enabled_for_request() {
$enabled = is_single()
$enabled = is_singular()
&& ! is_attachment()
&& ! is_admin()
&& ! is_embed()
&& ( ! $this->allow_feature_toggle() || $this->get_option( 'enabled' ) );

/**
* Filter the Enabled value to allow related posts to be shown on pages as well.
* Filter the Enabled value to allow related posts to be selectively enabled/disabled.
*
* @module related-posts
*
Expand Down

0 comments on commit bf52578

Please sign in to comment.