I have a url /abcde-post and it is redirecting to home page. Is there a way in wordpress to find out the post edit link from the url

1 Answer 1


Yes, there is. You can use url_to_postid function:

$postid = url_to_postid( $url );

It will give you ID of a post based on URL.

So if you want to get edit link, then this will do exactly that:

$postid = url_to_postid( $url );
if ( $postid ) {
    echo get_edit_post_link( $postid );

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.