Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unexpected empty paragraphs produced rendering home-query.html template part #20

Closed
bobbingwide opened this issue Nov 5, 2020 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@bobbingwide
Copy link
Owner

With the home-query.html template part I noticed a number of white sections which were associated with empty paragraphs.
image

<!-- wp:group {"className":"posts"} -->
<div class="wp-block-group posts"><div class="wp-block-group__inner-container"><!-- wp:columns -->
    <div class="wp-block-columns"><!-- wp:column {"width":"100%"} -->
        <div class="wp-block-column" style="flex-basis:100%"><!-- wp:query-loop -->
            <!-- wp:group -->
            <div class="wp-block-group"><div class="wp-block-group__inner-container"><!-- wp:post-title /-->

                <!-- wp:post-featured-image {"isLink":true} /-->

                <!-- wp:post-excerpt {"moreText":""} /-->

                <!-- wp:columns -->
                <div class="wp-block-columns"><!-- wp:column {"width":"33.33%"} -->
                    <div class="wp-block-column" style="flex-basis:33.33%"><!-- wp:paragraph -->
                        <p>Published:</p>
                        <!-- /wp:paragraph -->

                        <!-- wp:paragraph -->
                        <p>Last updated:</p>
                        <!-- /wp:paragraph -->

                        <!-- wp:paragraph -->
                        <p>Filed Under:</p>
                        <!-- /wp:paragraph --></div>
                    <!-- /wp:column -->

                    <!-- wp:column {"width":"66.66%"} -->
                    <div class="wp-block-column" style="flex-basis:66.66%"><!-- wp:post-date {"format":"F j, Y"} /-->

                        <!-- wp:post-date {"format":"F j, Y"} /-->

                        <!-- wp:post-hierarchical-terms {"term":"category"} /--></div>
                    <!-- /wp:column --></div>
                <!-- /wp:columns --></div></div>
            <!-- /wp:group -->

            <!-- wp:spacer {"height":39} -->
            <div style="height:39px" aria-hidden="true" class="wp-block-spacer"></div>
            <!-- /wp:spacer -->
            <!-- /wp:query-loop --></div>
        <!-- /wp:column --></div>
    <!-- /wp:columns -->
    <!-- wp:query-pagination /-->
</div></div>
<!-- /wp:group -->

Explanation

  • These unexpected white sections were associated with empty paragraphs that had been generated by wpautop()
    run against the content generated gutenberg_render_block_core_template_part() ...
    Actually, my latest version, fizzie_lazy_render_block_core_template_part( ).

I need to check whether or not it's any of my own plugins that are causing this.

@bobbingwide bobbingwide added the bug Something isn't working label Nov 5, 2020
@bobbingwide bobbingwide self-assigned this Nov 5, 2020
@bobbingwide
Copy link
Owner Author

I need to check whether or not it's any of my own plugins that are causing this.
It wasn't. I tested with only two plugins active. Gutenberg 9.3 and oik-bwtrace.
I used oik-bwtrace to view the $content before and after calling wpautop().

Looking at the code in the call stack, there's a comment in do_blocks() associated with code that removes wpautop() from the_content filtering.

// If there are blocks in this content, we shouldn't run wpautop() on it later.

My conclusion is that either wpautop() should not be called, or the comment is wrong.
Given that not calling wpautop() resolves the issue, I think we should obey the comment.

Note: the logic to remove and restore the wpautop() filter hook relies on the fact that wpautop() is the last filter function attached for a particular priority.
If it's not, it becomes the last.
This could affect the results of the filtering.

@bobbingwide
Copy link
Owner Author

This has been fixed by WordPress/gutenberg#30552

There was another fix reverting a change which made empty paragraphs visible.
WordPress/gutenberg#29809
But I never had that particular problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant