Piklist allows you to lock a field value (making it Read only), when the post status changes. A perfect example of this is if you want to lock post meta once a post is Published.

Here’s how we do that:
If you are already using Piklist, then skip to step 4.
- Install Piklist
- Decide if you are going to build your Piklist code as a plugin or in your theme.
- With Piklist you can display fields as Metaboxes, on a Settings page or a Widget. Choose which one you want to use.
- Create your field the standard Piklist way. For this tutorial we will create a TEXT Box. The only difference is that you will add the on_post_status parameter. You’ll notice that it is set to show values when the post status equals publish.
piklist('field', array(
'type' => 'text'
,'field' => 'sample_field'
,'label' => 'Sample Field'
,'attributes' => array(
'class' => 'small-text'
)
,'on_post_status' => array(
'value' => 'publish'
)
));
Believe it or not, that’s it!
Show Values on different Post Statuses
You can also show values on a post status, or a group of post statuses.
- First register and create post statuses as described in this tutorial.
- Using this example, and the code above, you can show values on a group of post statuses by separating them with a comma. The example below will show values on the post statuses “repair-declined” and “closed”
piklist('field', array(
'type' => 'text'
,'field' => 'sample_field'
,'label' => 'Sample Field'
,'attributes' => array(
'class' => 'small-text'
)
,'on_post_status' => array(
'value' => 'repair-declined','closed'
)
));
Show Values on a range of Post Statuses
You can also show values on a range of post statues.
- First register and create post statuses as described in this tutorial.
- Using this example, and the code above, you can show values on a range of statuses by using double hyphens as the separator:
--The example below will show values for ALL STATUSES BETWEEN “repair-declined” and “closed”
piklist('field', array(
'type' => 'text'
,'field' => 'sample_field'
,'label' => 'Sample Field'
,'attributes' => array(
'class' => 'small-text'
)
,'on_post_status' => array(
'value' => 'repair-declined--closed'
)
));