Title: IF conditional using post status
Last modified: March 8, 2021

---

# IF conditional using post status

 *  [milarosa](https://wordpress.org/support/users/milarosa/)
 * (@milarosa)
 * [5 years, 2 months ago](https://wordpress.org/support/topic/if-conditional-using-post-status/)
 * Hello,
 * I want to ask, Can custom content shortcodes use if conditionals based on post
   status? I want to hide some content if the post status is publish, I use this
   shortcode but not working,[if field=post-status value=publish] Can you help me
 * Thank You

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

 *  [polarracing](https://wordpress.org/support/users/polarracing/)
 * (@polarracing)
 * [5 years, 2 months ago](https://wordpress.org/support/topic/if-conditional-using-post-status/#post-14150805)
 * You are comparing to the wrong value – try:
 * `[if field=post-status value=published]`
 *  Thread Starter [milarosa](https://wordpress.org/support/users/milarosa/)
 * (@milarosa)
 * [5 years, 2 months ago](https://wordpress.org/support/topic/if-conditional-using-post-status/#post-14154046)
 * Hello [@polarracing](https://wordpress.org/support/users/polarracing/)
 * Thank you it’s working now, but I have 1 question.
    if I have a post with the
   status “Expired”, so the value that I should add in the shortcode is from the
   value on the database or name on the status on a post? like status “publish” 
   on the database is “publish” but we use published for value in the shortcode.
 * I have already tried this :
    [if field=post-status value=gd-expired] : value 
   gd_expired (on database) [if field=post-status value=expired] : value expired(
   on status post) but is still not working
 * Thank You
 *  Thread Starter [milarosa](https://wordpress.org/support/users/milarosa/)
 * (@milarosa)
 * [5 years, 2 months ago](https://wordpress.org/support/topic/if-conditional-using-post-status/#post-14154394)
 * [@polarracing](https://wordpress.org/support/users/polarracing/) it’s already
   working and resolved Thank You

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

The topic ‘IF conditional using post status’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/custom-content-shortcode_766976.svg)
 * [Custom Content Shortcode](https://wordpress.org/plugins/custom-content-shortcode/)
 * [Support Threads](https://wordpress.org/support/plugin/custom-content-shortcode/)
 * [Active Topics](https://wordpress.org/support/plugin/custom-content-shortcode/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/custom-content-shortcode/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/custom-content-shortcode/reviews/)

 * 3 replies
 * 2 participants
 * Last reply from: [milarosa](https://wordpress.org/support/users/milarosa/)
 * Last activity: [5 years, 2 months ago](https://wordpress.org/support/topic/if-conditional-using-post-status/#post-14154394)
 * Status: not resolved