Product Collection: Handle empty block content in process_pagination_links method (#44575)

* Handle empty block content in process_pagination_links method

This commit introduces a check for empty block content in the `process_pagination_links` method of the `ProductCollection` class. This change ensures that if the block content is empty, the method will immediately return the original content without attempting further processing. This enhancement prevents potential errors or unnecessary processing steps on empty content.

* Add changefile(s) from automation for the following project(s): woocommerce

---------

Co-authored-by: github-actions <github-actions@github.com>
This commit is contained in:
Manish Menaria 2024-02-16 11:35:59 +05:30 committed by GitHub
parent f513ce7c25
commit 017b5e249a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 0 deletions

View File

@ -0,0 +1,4 @@
Significance: patch
Type: dev
Comment: Fix following notice on frontend: `Notice: Function WP_HTML_Tag_Processor::seek was called incorrectly. Unknown bookmark name. Please see <a>Debugging in WordPress</a> for more information. (This message was added in version 6.2.0.)`

View File

@ -159,6 +159,10 @@ class ProductCollection extends AbstractBlock {
* @return string The updated block content.
*/
private function process_pagination_links( $block_content ) {
if ( ! $block_content ) {
return $block_content;
}
$p = new \WP_HTML_Tag_Processor( $block_content );
$p->next_tag( array( 'class_name' => 'wp-block-query-pagination' ) );