Title: Shortcode &#8211; is_empty or null
Last modified: August 21, 2016

---

# Shortcode – is_empty or null

 *  Resolved [max34211](https://wordpress.org/support/users/max34211/)
 * (@max34211)
 * [11 years, 11 months ago](https://wordpress.org/support/topic/shortcode-is_empty-or-null/)
 * Hi there,
 * I have this shortcode that im creating where if an attribute is empty I don’t
   want anything to happen. Can somebody tell me what I should use to do so?
 *     ```
       if(!empty($ptitle)){
          //dont do anything
          }else{
          //do this code
          }
       ```
   

Viewing 1 replies (of 1 total)

 *  [catacaustic](https://wordpress.org/support/users/catacaustic/)
 * (@catacaustic)
 * [11 years, 11 months ago](https://wordpress.org/support/topic/shortcode-is_empty-or-null/#post-4872151)
 *     ```
       if( !empty( $ptitle )) {
            // Do your stuff in here!
       }
       ```
   
 * That’s what you’re looking for. That says that if the value isn’t empty then 
   do something, and if it is empty there’s nothing to do.

Viewing 1 replies (of 1 total)

The topic ‘Shortcode – is_empty or null’ is closed to new replies.

## Tags

 * [shortcode](https://wordpress.org/support/topic-tag/shortcode/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 1 reply
 * 2 participants
 * Last reply from: [catacaustic](https://wordpress.org/support/users/catacaustic/)
 * Last activity: [11 years, 11 months ago](https://wordpress.org/support/topic/shortcode-is_empty-or-null/#post-4872151)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
