How to Replace ?page_id= and ?p= with Title-Based URLs in WordPress

Victor Duse

Jan 25, 2025

Comments

Editorial Note: I may earn a commission when you visit links on this website.

Is WordPress generating confusing URLs for your pages and posts, like /page_id=6 and /p=2? Let’s solve this problem by enabling “pretty links” that correspond to your page titles.

Why WordPress Creates Permalinks with Page and Post ID Numbers

Every page and post on your WordPress site is assigned a unique ID number in the database. These IDs allow WordPress to generate dynamic links regardless of the page titles. By default, WordPress uses these IDs to create URLs for your content.

In a fresh WordPress installation, you’ll typically find permalinks like:

  • /page_id=2 – Sample Page
  • /page_id=3 – Privacy Policy
  • /p=1 – Hello World!

If you create a new page or post, its URL will include a unique ID number by default.

En example of a default WordPress URL with a page ID

An example of a WordPress URL with the page ID 3.

Why Default WordPress ID URLs Are Problematic

There are several compelling reasons to change your permalink structure from the default “Plain” setting (using ID numbers) to “Pretty Links,” which are based on page names. For example, the Privacy Policy page URL should look like /privacy-policy/ instead of /page_id=3.

  1. Improved User Experience
    A URL that includes the page name clearly indicates the content of the link, making it easier for users to understand.
  2. Search Engine Optimization (SEO)
    Keywords in your URLs are an important ranking factor for search engines like Google and Bing.
  3. Increased Trust
    Links containing parameters like ?page_id=6 can appear suspicious. Some users may avoid clicking such links due to security concerns.

How to Replace Page IDs with Page Titles in WordPress URLs

Fortunately, replacing ID numbers with readable page titles in your WordPress URLs is quick and easy.

Steps to Update Your Permalink Structure

  1. Log in to your WordPress Dashboard.
  2. Go to Settings > Permalinks.
  3. Choose a New Permalink Structure:
    – Select “Post name” to create clean URLs based on your page or post titles.
    Pro Tip: For more advanced settings, choose Custom Structure and define a format, such as /blog/%postname%/ for blog posts.
  4. Save Changes: Click the Save Changes button at the bottom of the screen.
  5. Clear Your Cache: If necessary, clear your site cache and browser cache to ensure the new URLs display correctly.
Choose "Post name" to enable pretty links in the WordPress permalink settings.

Choose “Post name” in Settings » Permalinks in the WordPress admin area.

That’s it! Your ID-based URLs have now been replaced with user-friendly, SEO-friendly URLs that are based on page and post names. WordPress will automatically convert your URLs to lowercase, remove invalid characters, and replace spaces with hyphens.

Before (Plain permalink)

En example of a default WordPress URL with a page ID

An example of a Plain Permalink in WordPress.

After (Post name permalink)

A pretty permalink where the page name or page title is visible in the URL

The same page with a pretty Post Name Permalink.

What Happens to Your Old ID-Based URLs?

You don’t need to update all your internal links or create 301 redirects to preserve SEO and traffic. The old ID-based URLs will still work – they’ll automatically redirect visitors to the correct “pretty link.”

Behind the scenes, WordPress continues to use page and post IDs in the backend, but you no longer have to display these IDs to your visitors.

That’s all for today!

I hope that you enjoyed this post. Subscribe to VictorDuse.com on YouTube and join our Facebook group for more crisp content on WordPress and web design.

👉 Related post: Why WordPress Adds -2 To Your URL (And How To Remove It)

👉 Free course: Create a website from scratch with Divi

Victor Duse

By Victor Duse

Victor is a Swedish WordPress expert with +20 years experience of web development and marketing communications. Time away from keyboard is spent together with family and on Brazilian Jiu-Jitsu mats.

About Victor » 

Related posts

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *