Guest User

Untitled

a guest
May 23rd, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. <?php
  2. /* preview posts */
  3. add_filter('posts_results', function( $posts )
  4. {
  5. if( !empty($posts) && isset($_GET['key']) && $_GET['key'] === md5($posts[0]->ID.'secret') )
  6. {
  7. $posts[0]->post_status = 'publish';
  8. }
  9. return $posts;
  10. }, 10, 2);
  11. add_action( 'post_submitbox_misc_actions', function()
  12. {
  13. $post = get_post();
  14. if( $post->post_type !== 'post' || $post->post_status === 'publish' )
  15. {
  16. return;
  17. }
  18. echo '<div style="padding:6px 10px 8px"><a href="'.get_permalink($post->ID).'&key='.md5($post->ID.'secret').'">Γ–ffentliche Vorschau</a></div>';
  19. });
Add Comment
Please, Sign In to add comment