How to Remove Parent Slug From Child Page URL in WordPress

Wp Plugins

Are you wondering how to remove the parent page slug from a child page URL in WordPress?

By default, WordPress adds the parent page’s slug as a prefix to child page URLs, and this is good for SEO. However, some people may not want the parent page slug in the URL.

In this article, we will show you how to remove the parent page slug from a child page URL in WordPress.

How to Remove Parent Slug From Child Page URL in WordPress

What Is a Parent Page Slug in WordPress?

Your WordPress website comes with two main content types called posts and pages.

Pages are hierarchical, which means they can have child pages. These child pages are dependent on their parent pages and typically cover subtopics related to the parent.

For example, you might have a ‘Products’ parent page with ‘Pricing’, ‘Support’, and ‘Features’ child pages.

By default, the URL of a child page in WordPress will have its parent page’s slug in the URL. Here’s an example:

http://example.com/parent-page/child-page/

Using URLs like this is the best way to organize content within a hierarchical page structure on your website. These URLs are considered best practice for WordPress SEO and will make sense to your users when they read them.

It’s usually not a good idea to remove the parent page slug. It can potentially break the URL, and some experts believe it is less SEO-friendly. Sometimes, it may even cause conflicts with the WordPress permalink structure.

In our experience, if you don’t want a parent page slug in your child page URL, then the best approach is to not create a child page at all. Instead, you can simply create a normal page and use a navigation menu to show that other pages belong under that page.

Adding Child Items to a Menu

However, we understand that some users may still want to use child pages and not include the parent page slug within the URL.

That being said, let’s take a look at how to easily remove the parent page slug from a child page URL in WordPress.

Removing Parent Page Slug From Child Page URL in WordPress

The first thing you need to do is install and activate the Custom Permalinks plugin. For more details, see our step-by-step guide on how to install a WordPress plugin.

Upon activation, you need to edit the child page that you want to change. Under the content area, you will see a ‘Custom Permalinks’ field where you can change the child page URL.

Change child page URL

The permalink field will show your page’s current default URL. You just need to click it and enter the custom URL you want to use for your child page.

In our example, the hollywood-boulevarde page is a child page oflocations, so the default permalink is locations/hollywood-boulevarde.

We deleted the locations parent slug from the URL, as you can see in the screenshot below.

Custom page URL

Don’t forget to click the ‘Update’ button to save your page and store your URL changes.

After saving your changes, the plugin will automatically redirect the old permalink to the new address. This means your visitors will not see a 404 error if they click a link or bookmark to the page’s old address.

When you view the child page, you will now notice that its URL does not contain the parent slug.

Our Best Guides on Pages and Child Pages

Now that you know how to customize a child page’s URL in WordPress, you may want to learn more about how to use pages and child pages in WordPress:

We hope this article helped you learn how to remove the parent page slug from a child page URL in WordPress. You may also want to see our guide on how to create a custom page in WordPress or our expert picks for the best drag and drop page builder plugins for WordPress.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

The post How to Remove Parent Slug From Child Page URL in WordPress first appeared on WPBeginner.

An Introduction to WordPress User Permissions (And User Roles)

Category Image 091
WordPress user permissions.One of the great things about WordPress is that it lets you collaborate with other users on the back end of your site. You can assign different user roles based on tasks and responsibilities. However, if you’re new to the system, you might wonder what WordPress user permissions come with each role. In this post, we’ll start with a general discussion of WordPress user roles and deep dive into the WordPress user permissions associated with each of the six main roles.

How can I combine these classes

558fe5180e0e8fc922d31c23ef84d240

I have a web page that loads images with a modal, and at the same time is meant to inhibit image piracy by delivering a transparent overlay when a user attempts to make a screen copy of the image.
I have two php lines of image scripts which work OK independently, but when I attempt to combine them into one div, only script one will work. You can see that I've commented out the second image here (which delivers the transparent overlay) and the first image (which creates the modal) then works, and vice versa but I want to use them both at the same time. How can they be successfully combined?
It is unsuccessful if I do class="first second modal-target "

<style>
.modal-target {
    width: 390px;
    /* sets the width of the image */
    border-radius: 5px;
    cursor: pointer;
    transition: 0.3s;
}
</style>


<style>
.first {
    position: relative;
}

.second {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}
</style>

<div class="first">
<!-- the following line delivers some images and their title to the web page -->
    <img class="modal-target" src="<?php echo $file_source; ?>" &nbsp;&nbsp;&nbsp; alt="<?php echo $title; ?>" width="400">
 <!-- the following line prevents a user from copying the image from the webpage -->
<img class="second" src='../images/Copyright.gif' alt='This image is copyright'>
</div>
<!-- there are further scripts including some php and javascript related to the modal but as the modal works OK I haven't included them here -->

Ultimate Guide to Managing WordPress Multi Sites

Featured Imgs 13
If you are planning to run a WordPress multisite, there are several crucial steps you need to follow in order to set everything up correctly. It’s important to thoroughly follow these steps to ensure that your additional sites function properly. Let’s dive into the process of creating and managing a WordPress multisite network. Enabling the […]

Automating Data

Featured Imgs 23

In today’s world, where information holds the highest precedence, it won’t be wrong to say, “Data is the new gold.” Every move we make now is a data point; running an errand to the supermarket where we earn points by scanning the app with our details filled out, making a reservation at a hotel, or signing up to watch a movie online, data today is digitized.

Importance of Digital Data

Until a decade ago, when paper records used to hold information, storing wasn’t the only problem; it needed to be organized for quick and easy access, but the major issue began when the number of records increased. 

Where to Find Working Canva Coupons & Deals

Featured Image 01
Did you know you can save a significant amount on your Canva purchases and subscriptions? With Canva coupons and special offers, you can unlock powerful design tools without breaking the bank. In this guide, we’ll walk you through the process of maximizing your savings and getting the best deals on Canva using Canva coupons. Key […]

Essential Security Measures for PDF Documents

Featured Imgs 23

Portable Document Format (PDF) is a file format that contains a comprehensive representation of a document, encompassing elements like text, fonts, graphics, and other components. PDF is often considered a secure document format due to its inherent security features. These capabilities enable the incorporation of password protection, encryption, and digital signatures into a file.

PDF security is important for several reasons. Information is often shared over the internet, and ensuring the privacy and integrity of sensitive data during such exchanges is paramount. Whether the PDF contains a legal contract, a confidential business report, or personal information, proper PDF security ensures that only authorized individuals can access or modify the contents of these documents. PDF security not only protects intellectual property but can also help you comply with legal and regulatory requirements. This makes it an indispensable tool in today's interconnected world.

Pagination of an Infinite List of Records in Salesforce

Category Image 091

What Is Pagination?

Put simply, it's page-by-page navigation. It's a way to display a large amount of homogeneous information by dividing the content into pages. Many Salesforce developers, myself included, often encounter pagination when displaying a significant volume of data on the user interface. On one of my projects, we were presenting phone numbers in a data table. However, in certain cases, the data wouldn't display, as the information retrieval took too long. Users were unable to access any data. So, why did this happen?

1. Contacts Were Selected Through Several Nested Database Queries

We were dealing with multiple levels of parent-child relationships between Contacts and child objects. Due to business logic requirements, we needed to filter contacts based on filters applied both to the contacts themselves and to filters applied to the child objects of the contacts.