How Wordpress can destroy a header

I still don't understand how wordpress can figure out that this url is referring to: www.mysite.com/about-me/

they don't use id

if they use slug functions, so how can they save history information or in other words how they change back the punched header to select from the database

+2


a source to share


2 answers


It parses the "pretty" URL and queries the database with this data. Of course, the slug is checked for uniqueness upon creation. Details are in the function url_to_postid()

in the file wp-includes/rewrite.php

.

If you want to get the id from the bullet directly, you can query the database:



SELECT ID
FROM wp_posts
WHERE post_name = '$slug'

      

you may need to check wp_posts

which is the default name, but it depends on the installation.

+6


a source


This is just a guess:



I am assuming that they store the headers in the database and ensure that each header is unique. This way they can search by name and know which element is associated with it.

0


a source







All Articles