equal
deleted
inserted
replaced
175 $is_post_type = $is_post_type || isset( $attributes['type'] ) && ( 'post' === $attributes['type'] || 'page' === $attributes['type'] ); |
175 $is_post_type = $is_post_type || isset( $attributes['type'] ) && ( 'post' === $attributes['type'] || 'page' === $attributes['type'] ); |
176 |
176 |
177 // Don't render the block's subtree if it is a draft or if the ID does not exist. |
177 // Don't render the block's subtree if it is a draft or if the ID does not exist. |
178 if ( $is_post_type && $navigation_link_has_id ) { |
178 if ( $is_post_type && $navigation_link_has_id ) { |
179 $post = get_post( $attributes['id'] ); |
179 $post = get_post( $attributes['id'] ); |
180 if ( ! $post || 'publish' !== $post->post_status ) { |
180 /** |
|
181 * Filter allowed post_status for navigation link block to render. |
|
182 * |
|
183 * @since 6.8.0 |
|
184 * |
|
185 * @param array $post_status |
|
186 * @param array $attributes |
|
187 * @param WP_Block $block |
|
188 */ |
|
189 $allowed_post_status = (array) apply_filters( |
|
190 'render_block_core_navigation_link_allowed_post_status', |
|
191 array( 'publish' ), |
|
192 $attributes, |
|
193 $block |
|
194 ); |
|
195 if ( ! $post || ! in_array( $post->post_status, $allowed_post_status, true ) ) { |
181 return ''; |
196 return ''; |
182 } |
197 } |
183 } |
198 } |
184 |
199 |
185 // Don't render the block's subtree if it has no label. |
200 // Don't render the block's subtree if it has no label. |