Title: Custom block cannot be hidden
Last modified: June 9, 2021

---

# Custom block cannot be hidden

 *  Resolved [Mark Howells-Mead](https://wordpress.org/support/users/markhowellsmead/)
 * (@markhowellsmead)
 * [4 years, 10 months ago](https://wordpress.org/support/topic/custom-block-cannot-be-hidden/)
 * We have programmed a custom block using React and in line with the WordPress 
   documentation and standards. When we set the visibility of the block to “Show
   block to selected” with User Status “Logged In”, the block still appears to visitors
   who are not logged-in. The add-on “Members – Block Permissions” is active.
 * Do we need to register the block somehow, so that this setting works correctly?

Viewing 15 replies - 1 through 15 (of 18 total)

1 [2](https://wordpress.org/support/topic/custom-block-cannot-be-hidden/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/custom-block-cannot-be-hidden/page/2/?output_format=md)

 *  Thread Starter [Mark Howells-Mead](https://wordpress.org/support/users/markhowellsmead/)
 * (@markhowellsmead)
 * [4 years, 10 months ago](https://wordpress.org/support/topic/custom-block-cannot-be-hidden/#post-14537409)
 * I’ve tested further and the problem seems to be related to all of our own React
   blocks, not just the one for which I raised the issue.
 *  Thread Starter [Mark Howells-Mead](https://wordpress.org/support/users/markhowellsmead/)
 * (@markhowellsmead)
 * [4 years, 10 months ago](https://wordpress.org/support/topic/custom-block-cannot-be-hidden/#post-14537422)
 * The block source code is temporarily available at [https://gist.github.com/markhowellsmead/c254c68cf5eaa15b287aa8766ec660d9](https://gist.github.com/markhowellsmead/c254c68cf5eaa15b287aa8766ec660d9)
 *  Thread Starter [Mark Howells-Mead](https://wordpress.org/support/users/markhowellsmead/)
 * (@markhowellsmead)
 * [4 years, 10 months ago](https://wordpress.org/support/topic/custom-block-cannot-be-hidden/#post-14540216)
 * Additional debugging in the plugin code has led me to the fact that the “Condition”
   is not saved with the Block when saving a Post or Page containing these custom
   blocks. After saving the Post or Page and then reloading the editor, the value
   is always reset back to “Show block to everyone”.
 *  Plugin Author [Caseproof LLC](https://wordpress.org/support/users/caseproof/)
 * (@caseproof)
 * [4 years, 10 months ago](https://wordpress.org/support/topic/custom-block-cannot-be-hidden/#post-14545244)
 * Hi Mark,
 * Are you experiencing this issue with saving with default WordPress blocks or 
   only or your custom blocks?
 * Kind regards
 *  Thread Starter [Mark Howells-Mead](https://wordpress.org/support/users/markhowellsmead/)
 * (@markhowellsmead)
 * [4 years, 10 months ago](https://wordpress.org/support/topic/custom-block-cannot-be-hidden/#post-14545277)
 * Only non-Core blocks.
 *  [HansVanEijsden](https://wordpress.org/support/users/hansvaneijsden/)
 * (@hansvaneijsden)
 * [4 years, 10 months ago](https://wordpress.org/support/topic/custom-block-cannot-be-hidden/#post-14556048)
 * I can confirm: I also have the same problem.
    Theme: GeneratePress Premium. PHP:
   8.0.7 Nginx: 1.20.1 MariaDB: 10.5.10 As soon as I try to save permissions for
   non-core blocks, they are defaulting back as soon as I save the page. Core blocks
   work fine.
 *  Plugin Author [Caseproof LLC](https://wordpress.org/support/users/caseproof/)
 * (@caseproof)
 * [4 years, 10 months ago](https://wordpress.org/support/topic/custom-block-cannot-be-hidden/#post-14563530)
 * Hi [@markhowellsmead](https://wordpress.org/support/users/markhowellsmead/), 
   [@hansvaneijsden](https://wordpress.org/support/users/hansvaneijsden/)
 * [@markhowellsmead](https://wordpress.org/support/users/markhowellsmead/), your
   block uses an inner block, so our developer thought that this is related, but
   the permissions settings apply to inner blocks. If you need to troubleshoot this
   more, please take a look at this section of code:
    [https://github.com/caseproof/members/blob/758a28a0f7ca8524a3b6157794b041a379c050d2/addons/members-block-permissions/src/Block.php#L50](https://github.com/caseproof/members/blob/758a28a0f7ca8524a3b6157794b041a379c050d2/addons/members-block-permissions/src/Block.php#L50)
 * Best
 *  Thread Starter [Mark Howells-Mead](https://wordpress.org/support/users/markhowellsmead/)
 * (@markhowellsmead)
 * [4 years, 10 months ago](https://wordpress.org/support/topic/custom-block-cannot-be-hidden/#post-14563559)
 * The same issue applies to custom blocks which don’t use InnerBlocks. The permissions
   setting on the block isn’t saved.
 * e.g. #2: [https://gist.github.com/markhowellsmead/ab4d6161dd176a103cbb1dec44da832c](https://gist.github.com/markhowellsmead/ab4d6161dd176a103cbb1dec44da832c)
 *  [HansVanEijsden](https://wordpress.org/support/users/hansvaneijsden/)
 * (@hansvaneijsden)
 * [4 years, 10 months ago](https://wordpress.org/support/topic/custom-block-cannot-be-hidden/#post-14563572)
 * Hi [@caseproof](https://wordpress.org/support/users/caseproof/), thank you for
   your reply and your hint.
 * I am using GenerateBlocks to generate the Partner Access button on [https://sykam.com/downloads/](https://sykam.com/downloads/)
   and it’s a container block, with then a buttons block and within that buttons
   block a single button.
    But… I just discovered it also happens with non-inner-
   blocks. Whatever I try, I simply cannot get it to save the permission settings.
 * Just let me know if you need a temporary login. I’m happy to help where possible.
 *  Thread Starter [Mark Howells-Mead](https://wordpress.org/support/users/markhowellsmead/)
 * (@markhowellsmead)
 * [4 years, 9 months ago](https://wordpress.org/support/topic/custom-block-cannot-be-hidden/#post-14606934)
 * Is there any progress on this problem please, [@caseproof](https://wordpress.org/support/users/caseproof/)?
   We’re blocked with a couple of projects until the issue has been resolved.
 *  Plugin Author [Caseproof LLC](https://wordpress.org/support/users/caseproof/)
 * (@caseproof)
 * [4 years, 9 months ago](https://wordpress.org/support/topic/custom-block-cannot-be-hidden/#post-14608060)
 * Hi [@markhowellsmead](https://wordpress.org/support/users/markhowellsmead/) ,
   [@hansvaneijsden](https://wordpress.org/support/users/hansvaneijsden/)
 * This is related to the order in which scripts are loaded. When this happens, 
   the custom block scripts are loading before the permission settings (loaded by
   Members). We’ll release a fix in the next update. In the meantime, you can try
   to enqueue your block scripts with a lower priority (higher number) on the enqueue_block_editor_assets
   hook.
 * Best
 *  [HansVanEijsden](https://wordpress.org/support/users/hansvaneijsden/)
 * (@hansvaneijsden)
 * [4 years, 9 months ago](https://wordpress.org/support/topic/custom-block-cannot-be-hidden/#post-14608069)
 * [@caseproof](https://wordpress.org/support/users/caseproof/) thank you very much.
   Desperately looking forward to the update! 🙂
 *  Thread Starter [Mark Howells-Mead](https://wordpress.org/support/users/markhowellsmead/)
 * (@markhowellsmead)
 * [4 years, 9 months ago](https://wordpress.org/support/topic/custom-block-cannot-be-hidden/#post-14668552)
 * I’ve modified the priority on enqueue_block_editor_assets to 100, but the same
   problem persists.
 *  Plugin Author [Caseproof LLC](https://wordpress.org/support/users/caseproof/)
 * (@caseproof)
 * [4 years, 8 months ago](https://wordpress.org/support/topic/custom-block-cannot-be-hidden/#post-14694388)
 * Sorry for a bit slow response to your question.
 * [@markhowellsmead](https://wordpress.org/support/users/markhowellsmead/) Our 
   developer tested a custom block with that method and it worked for him. The only
   other thing we can think of that might help is to add a dependency to his custom
   block script. So when you hook into enqueue_block_editor_assets for his custom
   script, your callback will use wp_enqueue_script(). You can try adding members-
   block-permissions-editor as a dependency there.
 * Best
 *  [HansVanEijsden](https://wordpress.org/support/users/hansvaneijsden/)
 * (@hansvaneijsden)
 * [4 years, 6 months ago](https://wordpress.org/support/topic/custom-block-cannot-be-hidden/#post-14946677)
 * Hi [@caseproof](https://wordpress.org/support/users/caseproof/),
 * Currently I’m finishing the website, it has to be ready by tomorrow unfortunately.
   The only thing I’m waiting for, before I can publish, is the new Members version(
   or a patch/workaround) to solve the above problem.
 * Do you have any advice? Is there anything I can do to make the plugin work for
   me?
    Is there a possibility to beta-test the update, eventually?
 * Thanks!

Viewing 15 replies - 1 through 15 (of 18 total)

1 [2](https://wordpress.org/support/topic/custom-block-cannot-be-hidden/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/custom-block-cannot-be-hidden/page/2/?output_format=md)

The topic ‘Custom block cannot be hidden’ is closed to new replies.

 * ![](https://ps.w.org/members/assets/icon-256x256.png?rev=2503334)
 * [Members - Membership & User Role Editor Plugin](https://wordpress.org/plugins/members/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/members/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/members/)
 * [Active Topics](https://wordpress.org/support/plugin/members/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/members/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/members/reviews/)

 * 18 replies
 * 3 participants
 * Last reply from: [Mark Howells-Mead](https://wordpress.org/support/users/markhowellsmead/)
 * Last activity: [4 years, 4 months ago](https://wordpress.org/support/topic/custom-block-cannot-be-hidden/page/2/#post-15118823)
 * Status: resolved