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 );
}
Related Posts:
- Stop WordPress automatically adding tags to post content
- Print Current Post Index number within Loop
- Front-End Post Submission
- How To Disable (or Remove) “All Posts, Published, and Trash” in Dashboard Posts
- Let private posts stay in status “private” after edit through “editors”
- how to get a different html for odd/even posts?
- How to manually link posts to each other in WordPress
- Post/Page Publish/Update button not clickable once I make an edit
- How do I create a link that will always show the latest post?
- How to display posts by current user/author in a custom page template?
- Display all search results
- $post->ID not working
- featuring old articles without messing up with the archive
- Add default content to post (for specific category)
- Setting pagination for images attached to a post
- Display most recent post in category instead of archive?
- Is there a plugin that creates a WP post based on a Twitter account’s hashtag?
- blog page showing only first post
- Is it possible to show a different WP menu when using password protected pages?
- Human Time Diff, change mins to minutes
- POST from jQuery to PHP
- get_post_custom stripping styling issue
- Display the latest posts, published in the last hour, with WP_Query
- Including text at the end of every post
- same template for multiple custom post type single
- Redirect before post page
- Fetch posts from current week (Sunday to Saturday)
- Allowing the SoundCloud player to appear in a post excerpt
- Display the Content of a Post with qTip2
- Scheduled posting not working
- Converting multiple loops into one single loop with pagination
- How to set post expiration date and time and move the page to archive after expiration [closed]
- .current-menu-item class on custom post type children pages – again?
- Run a function when post is deleted?
- Get posts by multiple ID’s (query)
- Server-side sorting of posts
- Exclude posts w/ specific post_meta on Rest API endpoint
- Should $found_posts be returned as string in ‘found_posts’ filter hook?
- Admin Notices don’t display on the admin screen for certain post
- How to change wordpress dates to native language (even if the languge not available i wordpress)
- Theme removed “Edit Post” link on the front end. I wish it back
- WP_Query orderby not working with meta_value_num and menu_order
- Custom WP_Query with complex ‘post_status’ argument
- Saving category to a post, before publishing the post
- is there a way to show the the post title after the image?
- Add the description field on the attached media
- Is there a way to notify specific users when new posts are published to specific pages?
- Force authors to Preview a post before publishing
- Bulk delete WordPress posts with phpMyAdmin
- While loop articles – if statement order
- Show post content and title in diferent divs using WP_Query using a loop
- How to create a sub post?
- How to get post body look same as my visual editor?
- Check if a custom post type has already been created
- Uploading images in custom post form
- Isn’t the way posts are displayed very unefficient?
- Reinstall WordPress while keeping attachments
- Post Filtering by GET URL parameters
- showing posts of an specific category in admin custom menu with style of admin posts section
- Related Posts function not working
- Unabled to Change Permalinks – Even Using the “Edit” (Resets to Original Permalink on “Update”)
- Custom WP_Query not working correctly
- Echo the number of posts being displayed
- Get post related to particular meta box? [closed]
- Exclude a category of posts in author template
- post type slug vs page slug
- Open post within Foundation 3 Reveal
- marking a post that was sticky on category template
- Extract the last published post
- Deleting post tags removes categories
- Format array of objects to json for wp-json
- Add checkbox in admin post list – show checked post in widget
- How show custom message after post pulished or update
- MYSQL: Create SQL query to search for string and replace
- how to filter posts by category without page load (ajax) in wordpress?
- Display specific posts based on an ID of another post
- How do I scope out why I have two “posts” menus in an admin?
- long-title posts do not want published
- Add postmeta to all blog posts
- Enable HTML Tags in WordPress Post excerpt
- Checking if a post contains an html tag
- If taxonomy has more than 6 posts, display show all
- How to give priority to page than to posts permalink structure?
- Compare date of user’s last posts
- Only get post_id [duplicate]
- Disable `create_post` for built-in post type
- how to create other sizes of original image in one go wordpress uploads
- Post are not showing up
- how to remove entry meta from wordpress archive category and change its display
- Can’t seem to replicate permalink structure for localhost development site
- Newly created category does not show category
- Changing permalink of custom category
- Special Query: Title, Terms, Content – %LIKE%
- How to limit the number of posts a user can publish based on user type
- WordPress Custom Theme: My site shows the same posts on Page 1 and Page 2 and so on [duplicate]
- Add News Feed to bespoke website, only to one page on whole site
- How to display my categories in a list (to a post, not the sidebar)?
- WordPress post enumeration
- How to make the Post Author name fixed as “Editorial Staff” even if there are multiple authors?
- Trying to create parent for post. I need some help. Thanks