0

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

0

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 );
}
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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