The Rewrite API for WordPress is an important feature that you probably don’t read much about, yet you’re no doubt using without even realizing it. The API provides the functionality for creating your own unique links – permalinks – for your website. In this tutorial, I’ll explain permalinks in-depth – what they are, why they are permanent, their possible structures, and how you can rewrite them in a form that is intelligible for both humans and machines. I’ll also explain some key concepts behind permalinks in WordPress, first looking at how to add variables to non-optimized URLs and how to use these variables and their values to query your database. Later, we’ll explore URL rewriting and how to build the best structure for pretty permalinks. Let’s get started! What Are Permalinks? What is URL Rewriting? URLs are the vehicle used to send HTTP GET requests over the web. More precisely, the GET method submits key=value pairs within a URL to get a response from a specified resource (read more about this topic at W3Schools). Take the following URL: The question mark splits this URL into two parts. The first part is the domain name, the second part is the query
Share This