Title: Custom PHP Conditions?
Last modified: June 27, 2023

---

# Custom PHP Conditions?

 *  Resolved [cosm44](https://wordpress.org/support/users/cosm44/)
 * (@cosm44)
 * [2 years, 11 months ago](https://wordpress.org/support/topic/custom-php-conditions/)
 * Is there any way to write custom PHP conditions? I’m a code/PHP hack, so a simple
   example would be good if you have anything. Something like:
 *     ```wp-block-code
       <?php
       if ( my_custom_function === true ) {
          return false; // Block is Hidden
       }
       ?>
       ```
   
 * A different plugin, **Wicked Block Conditions** has a feature to “Show or hide
   blocks based on the result of a PHP function.” I may end up using it, but wanted
   to check and see if you had something similar.
 * Thanks!

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

 *  Plugin Author [Nick Diego](https://wordpress.org/support/users/ndiego/)
 * (@ndiego)
 * [2 years, 11 months ago](https://wordpress.org/support/topic/custom-php-conditions/#post-16852983)
 * Hi [@cosm44](https://wordpress.org/support/users/cosm44/),
 * No, Block Visibility does not support PHP conditions. Let me know if I can answer
   any additional questions.
 * Best,
   Nick
 *  Thread Starter [cosm44](https://wordpress.org/support/users/cosm44/)
 * (@cosm44)
 * [2 years, 11 months ago](https://wordpress.org/support/topic/custom-php-conditions/#post-16852994)
 * Any plans to support PHP conditions in the future?
 * Or perhaps you could help me figure out another way to do what I need…
 * I have a group block with a heading and query loop block inside. On certain pages,
   the query loop block returns 0 posts — I’d like to hide the entire group if that’s
   the case.
 * If that’s beyond the scope of the plugin, no big deal – thanks for the quick 
   reply!
 *  Plugin Author [Nick Diego](https://wordpress.org/support/users/ndiego/)
 * (@ndiego)
 * [2 years, 11 months ago](https://wordpress.org/support/topic/custom-php-conditions/#post-16853194)
 * Not currently, and there is no way to really accomplish what you are looking 
   for with Block Visibility. That said, [Conditional Blocks](https://wordpress.org/plugins/conditional-blocks/)
   and/or [Wicked Block Conditions](https://wordpress.org/plugins/wicked-block-conditions/)
   do support PHP functionality and might be worth a try.
 * Best, 
   Nick
 *  Thread Starter [cosm44](https://wordpress.org/support/users/cosm44/)
 * (@cosm44)
 * [2 years, 11 months ago](https://wordpress.org/support/topic/custom-php-conditions/#post-16853261)
 * Okay, thanks. Just wanted to check. 🙂

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

The topic ‘Custom PHP Conditions?’ 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: [cosm44](https://wordpress.org/support/users/cosm44/)
 * Last activity: [2 years, 11 months ago](https://wordpress.org/support/topic/custom-php-conditions/#post-16853261)
 * Status: resolved