Try this function:
url_to_postid( $url );
The WordPress codex is your friend. A quick Google search could have provided the answer.
Related Posts:
- When and Where is `global $post` Set and Available?
- Where is the “ancestors” post object attribute?
- Some custom post types did not return an object
- Code works on a page but not in a widget
- Change Posts per page count
- Random sort within an already sorted query
- Can I force a metabox to be in one column?
- Search by Hyphen
- Display the latest post from a category in a page
- rewind_posts() – what actually the use of it, and where using is required or preferred?
- Post publish only hook?
- Restrict access to post if it is currently being edited
- upload featured image from front end using wordpress add media button
- Trying to put an array into ‘post__in’ => array() query not working
- How to search only by post title and category?
- Display custom post types by date field
- Phantom 302 status code when sending a POST requests on pages
- How to change what the post creation page looks like?
- Does WordPress remove draft status automatically?
- Future_to_publish into postmeta
- How do I allow users to follow a post and then allow admins to email all users who have followed that post?
- $post object is null
- Is there any WordPress alternative to Book module of Drupal?
- Post Navigation
- How to start with post number x?
- Is it possible to change the admin posts per page view?
- Posts page only shows one post
- How do I find which articles are missing a featured image in The WordPress database?
- How can i sort the categories by ID
- Sidebar links for different pages
- How do I detect which page I’m on within a paginated post?
- Duplicating Table of Contents for Paginated Post
- how can I add data to posts that can be retrieved by WP Rest API
- Display tag image in post using Taxonomy Images plugin index.php
- Blog page not working
- Words must be included and restricted words in new posts
- wp_get_object_terms returns only Uncategorized on first publish
- Pausing and Resuming WP_Query results
- Can’t get buddypress notifications in front-end; why do I get this error?
- Getting Custom Post Loop to display in Bootstrap 3 column grid
- How to disable WordPress blog folder
- Automatically add date to the auto generation of post slug
- Sharing post from archive page (loop) doesn’t work
- Disable sticky option for specific categories
- Show only posts with images and a fixed amount of posts
- date issue with category post retrival
- How to get date of post when using wp_get_recent_posts()?
- how can i change WP main archives loop to sort by name or title
- Conditionals if tags exist?
- Crazy Question – Updating Post ID
- Showing categories and subcategories with posts
- Change default category when I publish a post
- Send POST request to WordPress to make a new post
- Append ‘Continue Reading’ link if post length is more than 3 lines of text?
- Can’t get full post title if there a spaces in title
- Site URL is not redirecting correctly
- How to display multiple images from the post on the homepage
- Unable to differentiate between two categories under custom post type on single.php
- WP_Query of Category Not Showing First Post
- content summary of a post disappears If an images added at the beginning of the post. how to solve it?
- How To Download WordPress Audio Attachments
- How to make blog posts have their own urls?
- How To Use Custom Fields With .mp3 Links
- How to add content above footer in posts from specific category
- Save / Update meta data as multidimensional array
- Select another post in a post meta like a parent page is selected while editing a page
- How to view a post from the wordpress admin screen
- Update all posts – 25 000 posts in total
- How to Create another Page Category like the “Post” and “Pages”
- Is it possible to change the default WP post table’s data source?
- a WordPress connected to 2 database
- Blog images not showing on homepage
- Not able to post data through wp-admin
- REST API Working for GET but not for POST?
- Manual Scheduler For Custom Post Type
- Multiple Pages – Seperate blogs
- Category posts show on local install, they do not show on live server
- Only show related posts when another post has same term
- Admin is showing all posts on page 1
- Embed button for post screen
- Alternating Post Styles on Homepage
- 3rd Party Login in wordpress
- Show a Category Specific Info Box
- Inserting image into post content – Front End
- Overwrite URL on blog posts
- post content includes and seo vs. duplicate content
- Posts don’t appear on the Blog page
- Display the first post’s comments of category in comments.php template
- Insert link to my thumbnail images
- Commenting on a post from the admin panel?
- How to filter categories of a post
- On the post list, how do you show different text to the main content?
- Showing Unpublished Posts to Logged-out Users?
- How do I add /blog/ on my permalink without affecting the portfolio project types permalink?
- Need All the posts with id, title and date [closed]
- List posts related to category on a div [closed]
- Ajax calls in wordpress
- Adding a content rating system
- How to get only post=’product’
- unable to select “fullwidth” on the POST (not page)