Title: Same rule, differents results.
Last modified: July 21, 2024

---

# Same rule, differents results.

 *  Resolved [shinkibo](https://wordpress.org/support/users/shinkibo/)
 * (@shinkibo)
 * [1 year, 9 months ago](https://wordpress.org/support/topic/same-rule-differents-results/)
 * Hello
 * 3 blocks, block A, B, C.
   Identical block short code to a script that randomly
   choose a post in category.The only difference is block A choose a random post
   in category 1, block B in cat 2 and Block C in cat 3.Posts are only in one category.
   So except the category ID, block are strictly identicals.
 * Block visibility rules are exactly the same for each block.
   Block A only appears
   on Category 1Block B only appears on Category 2Block C only appears on Category
   3Rules work for block A and B but not for block C.If I change the order of the
   block, let say Block A, C, B then rules work for block A and C but not for block
   B.

Viewing 4 replies - 1 through 4 (of 4 total)

 *  Plugin Author [Nick Diego](https://wordpress.org/support/users/ndiego/)
 * (@ndiego)
 * [1 year, 9 months ago](https://wordpress.org/support/topic/same-rule-differents-results/#post-17903751)
 * Hi [@shinkibo](https://wordpress.org/support/users/shinkibo/),
 * Thanks for reaching out. I attempted to replicate the issue using three Group
   blocks: A, B, C. I then created three new categories: A, B, C. Finally I created
   three posts, one for each category.
 * I tested with the Twenty Twenty-Four theme, so I then when into the Posts template
   in the Site Editor and added the three Group blocks to the top of the template.
   I set the Location control on Group A to only is Post Taxonomy > Category > Is
   at least one of the selected > A. I repeated this step for Group B and C.
 * I then visited the A post on the front end and saw Group A. I visited the B post
   and saw Group B, and the same for Group C.
 * Therefore, as far as I can tell, everything is functioning properly. I am wondering
   if the shortcode might be causing issues. I would try wrapping each shortcode
   in a Group block (or other container) and place the visibility conditions on 
   the outer container. Let me know if that works.
 * Best, 
   Nick
 *  Thread Starter [shinkibo](https://wordpress.org/support/users/shinkibo/)
 * (@shinkibo)
 * [1 year, 9 months ago](https://wordpress.org/support/topic/same-rule-differents-results/#post-17903918)
 * Definitely a problem on my side.
   Just made a test with 3 basics html block.just
   like previous example, Block A is supposed to only appear on Category 1, Block
   B with cat 2 and block C with cat 3.
 * First, black A and B appear only if “hide when rules apply” in on. 🙂
   Block A
   appears on cat 1, 2 and 3.Block B appears ont cat 1 and 2Block C appears on cat
   3.
 * I’ll made more tests and let you know if I find the reason.
 * edit : just made a test. If block A, B and C are the very first blocks on page,
   then Block A and B appears ont cat 1, 2 and 3 and block C never.
 * edit 2: if all blocks are in the header, all blocks appear on cat 1, 2, 3….
   ah
   ah ah!!!
 * edit 3 : if block between title and post content, everything work fine 🙂
    -  This reply was modified 1 year, 9 months ago by [shinkibo](https://wordpress.org/support/users/shinkibo/).
    -  This reply was modified 1 year, 9 months ago by [shinkibo](https://wordpress.org/support/users/shinkibo/).
    -  This reply was modified 1 year, 9 months ago by [shinkibo](https://wordpress.org/support/users/shinkibo/).
 *  Plugin Author [Nick Diego](https://wordpress.org/support/users/ndiego/)
 * (@ndiego)
 * [1 year, 9 months ago](https://wordpress.org/support/topic/same-rule-differents-results/#post-17945365)
 * Hi [@shinkibo](https://wordpress.org/support/users/shinkibo/),
 * I apologize for the delayed reply. It took me a long time to replicate this issue,
   which appears to be isolated to the HTML block. Something about the way this 
   block is rendered by WordPress itself is strange, but I did find a solution.
 * It seems that if the HTML block is contained inside of another block, such as
   a Group block, the visibility conditions are respected. This is not unique to
   Block Visibility.
 * I did some additional tests adding custom functionality to the HTML block. Without
   the block being wrapped in another container, the custom functionality is not
   respected.
 * You can test this by adding the following filter to the `functions.php` file 
   of your theme, and then inserting a HTML block in a block template without any
   container.
 *     ```wp-block-code
       function append_testing_to_html_block( $block_content, $block ) {    // Check if the block is an HTML block and has content.    if ( 'core/html' === $block['blockName'] && $block_content ) {        // Append the word "testing" to the block content.        $block_content .= ' testing';    }    return $block_content;}add_filter( 'render_block', 'append_testing_to_html_block', 100, 2 );
       ```
   
 * Since this issue does not appear to be related to Block Visibility, I am going
   to close this issue, but I’ll report it in the [Gutenberg](https://github.com/wordpress/gutenberg)
   repository so this issue can be solved in Core WordPress.
 * Thanks, 
   Nick
 *  Plugin Author [Nick Diego](https://wordpress.org/support/users/ndiego/)
 * (@ndiego)
 * [1 year, 9 months ago](https://wordpress.org/support/topic/same-rule-differents-results/#post-17945376)
 * For reference, I opened the issue here: [https://github.com/WordPress/gutenberg/issues/64420](https://github.com/WordPress/gutenberg/issues/64420)

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Same rule, differents results.’ is closed to new replies.

 * ![](https://ps.w.org/block-visibility/assets/icon-256x256.png?rev=3122657)
 * [Block Visibility — Conditional Visibility Control for the Block Editor](https://wordpress.org/plugins/block-visibility/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/block-visibility/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/block-visibility/)
 * [Active Topics](https://wordpress.org/support/plugin/block-visibility/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/block-visibility/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/block-visibility/reviews/)

 * 4 replies
 * 2 participants
 * Last reply from: [Nick Diego](https://wordpress.org/support/users/ndiego/)
 * Last activity: [1 year, 9 months ago](https://wordpress.org/support/topic/same-rule-differents-results/#post-17945376)
 * Status: resolved