I am reading the conversation about WP_USE_THEMES and I don't understand the term 'URL parsing'.
Can someone please explain that to me in the context of Wordpress ?
Google didn't produce significant results.
I am reading the conversation about WP_USE_THEMES and I don't understand the term 'URL parsing'.
Can someone please explain that to me in the context of Wordpress ?
Google didn't produce significant results.
Share Improve this question asked Sep 12, 2019 at 14:13 Rebecca JohnsonRebecca Johnson 111 bronze badge 1- Welcome to WordPress Development. I hope you find the answer(s) you are looking for. Our site is different from most - if you have not done so yet, consider checking out the tour and help center to find out how things work. – Matthew Brown aka Lord Matt Commented Sep 12, 2019 at 18:20
1 Answer
Reset to default 4Parsing means to analyze (a string or text) into logical syntactic components.
Taking WordPress URLs into the question is something like this:
// Get array of URL 'scheme', 'host', and 'path'.
$url_parse = wp_parse_url( 'https://developer.wordpress/reference/functions/wp_parse_url/' );
// Output URL's path.
echo $url_parse['path'];
/*
Array
(
[scheme] => https
[host] => developer.wordpress
[path] => /reference/functions/wp_parse_url/
)
*/
Another way to consider is in your WP settings. It breaks it down too:
https://www.example.coom/2019/09/12/sample-post/
is the same as
%scheme%//:%host%/%year%/%monthnum%/%day%/%postname%/
There are other uses for this too. In using the Wordpress API you'll need to know parts of the url (endpoint, version, etc).
Parsing is breaking the url down so you know what the parts are when you're working with it.