Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- add_filter( 'post_link', 'future_permalink', 10, 3 );
- function future_permalink( $permalink, $post, $leavename ) {
- /* for filter recursion (infinite loop) */
- static $recursing = false;
- if ( empty( $post->ID ) ) {
- return $permalink;
- }
- if ( !$recursing ) {
- if ( isset( $post->post_status ) && ( 'future' === $post->post_status ) ) {
- // set the post status to publish to get the 'publish' permalink
- $post->post_status = 'publish';
- $recursing = true;
- return get_permalink( $post, $leavename ) ;
- }
- }
- $recursing = false;
- return $permalink;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement