Created
February 16, 2015 01:10
-
-
Save mAAdhaTTah/7d9ff3e113610cb44bf0 to your computer and use it in GitHub Desktop.
Using Transients to Display Errors
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if ( $errors = get_transient( "my_save_post_errors_{$post_id}_{$user_id}" ) ) { | |
foreach( $errors as $error ) { ?> | |
<div class="error"><p> | |
<?php echo $error; ?> | |
</p></div><?php | |
} | |
delete_transient( "my_save_post_errors_{$post_id}" ) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if ( ! empty( $errors ) ) { | |
set_transient( "my_save_post_errors_{$post_id}_{$user_id}", $errors, 45 ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment