Title: Open Popup with conditional PHP code
Last modified: June 19, 2017

---

# Open Popup with conditional PHP code

 *  Resolved [capariciof](https://wordpress.org/support/users/capariciof/)
 * (@capariciof)
 * [8 years, 11 months ago](https://wordpress.org/support/topic/open-popup-with-conditional-php-code-2/)
 * Hello, you know how I can open the popup automatically using a command in php
   or html?
 * I have a condition function (if… else) in php and I require the popup to open
   with one certain condition.

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

 *  Plugin Author [Daniel Iser](https://wordpress.org/support/users/danieliser/)
 * (@danieliser)
 * [8 years, 11 months ago](https://wordpress.org/support/topic/open-popup-with-conditional-php-code-2/#post-9243389)
 * [@capariciof](https://wordpress.org/support/users/capariciof/) – Depends on your
   server setup, heavily cached servers for instance won’t work for all conditions
   via PHP, some require JS based conditions.
 * That said check out: [http://docs.wppopupmaker.com/article/132-add-a-custom-popup-condition](http://docs.wppopupmaker.com/article/132-add-a-custom-popup-condition)
 * That adds a new condition to the editor itself.
 * You can also use JavaScript manually to trigger it, (rendered by PHP).
 *     ```
       jQuery(document).ready(function () {
           PUM.open(123); // 123 is the popup ID #
       });
       ```
   
 *  Thread Starter [capariciof](https://wordpress.org/support/users/capariciof/)
 * (@capariciof)
 * [8 years, 11 months ago](https://wordpress.org/support/topic/open-popup-with-conditional-php-code-2/#post-9244663)
 * I can use user meta data with custom popup codition in a page?
 *  Plugin Author [Daniel Iser](https://wordpress.org/support/users/danieliser/)
 * (@danieliser)
 * [8 years, 11 months ago](https://wordpress.org/support/topic/open-popup-with-conditional-php-code-2/#post-9246255)
 * [@capariciof](https://wordpress.org/support/users/capariciof/) – Absolutely. 
   Anything you can do in PHP can be turned into a condition.
 * At the minimum you need to write a function that returns true or false. So if
   you wanted to check if a user meta value was set as a condition it could be as
   simple as
 *     ```
       function custom_condition_callback( $settings ) {
           return get_user_meta( get_current_user_id, 'meta_key' ) != false;
       }
       ```
   
 * That said conditions can be as complex or simple as you need them to be. The 
   link I gave above had several sample conditions of varying complexity.

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

The topic ‘Open Popup with conditional PHP code’ is closed to new replies.

 * ![](https://ps.w.org/popup-maker/assets/icon-256x256.gif?rev=3097653)
 * [Popup Maker - Boost Sales, Conversions, Optins, Subscribers with the Ultimate WP Popup Builder](https://wordpress.org/plugins/popup-maker/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/popup-maker/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/popup-maker/)
 * [Active Topics](https://wordpress.org/support/plugin/popup-maker/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/popup-maker/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/popup-maker/reviews/)

 * 3 replies
 * 2 participants
 * Last reply from: [Daniel Iser](https://wordpress.org/support/users/danieliser/)
 * Last activity: [8 years, 11 months ago](https://wordpress.org/support/topic/open-popup-with-conditional-php-code-2/#post-9246255)
 * Status: resolved