No Pretty Permalink during publish_post hook?
-
Hello! I have a function in my functions.php file that hooks into publish_post. The thing is, in my function I don’t seem to have access to the pretty version of the permalink, only the ugly version.
function my_function( $ID, $post ){ setup_postdata( $post ); wp_die( "Ugly Link: ".get_permalink() ); wp_reset_postdata(); } add_action( 'publish_post', 'my_function', 10, 2 );This prints out an ugly permalink like http://www.mysite.com/?p=2719 instead of a pretty permalink like http://www.mysite.com/this-is-a-test-post/
Is it possible to get access to the pretty permalink in the publish_post hook? I basically need my function to run whenever a post is published, and it’s important that I have the pretty permalink. Thanks for any guidance anyone can provide, it’s very much appreciated!
The topic ‘No Pretty Permalink during publish_post hook?’ is closed to new replies.