Method 1: Using Permalinks with Categories (Most Common)
This is the easiest and most popular way to create a nested URL structure for posts in WordPress. You essentially use your pillar page as a category and your cluster pages as posts assigned to that category.
Here’s a step-by-step guide:
Step 1: Set Up Your Permalinks
- In your WordPress dashboard, go to Settings > Permalinks.
- Select the “Custom Structure” option.
- In the text box, enter the following permalink structure:
/%category%/%postname%/
- Click “Save Changes.”
Using a Plugin for True Hierarchical Posts
If you absolutely need a parent-child relationship for posts that mimics the “Page Attributes” feature, you will need to use a plugin. These plugins change the default behavior of posts to make them hierarchical.
- Plugin Search: Look for plugins in the WordPress repository with terms like “hierarchical posts,” “post parent,” or “post type parent/child.”
- How it works: Once installed, these plugins will add a “Parent” dropdown to the Post editor sidebar, allowing you to select a parent post just like you would for a page.
- Nested Pages: This plugin provides a drag-and-drop interface that makes it easy to organize posts and pages hierarchically, giving you a tree view in the backend. just for viewing
Settings>>nested pages>> post types >> enable for posts>> after that >>posts>> Sort view >> drag drop just for viewing
- Post Types Order: While primarily for sorting, it has advanced features for hierarchical ordering.
Simple Custom Post Order: Not usable just drag drop posts in wordpres posts page.
- Custom Post Type UI (CPT UI): This is a developer-focused plugin that allows you to create your own custom post types. When creating a new post type, you can set
hierarchical
totrue
and enablepage-attributes
, which gives you the parent-child functionality you’re looking for. This is a very robust solution, but it means you would be using a “article” custom post type instead of the default “post” type.
Add page-attributes
to posts wordpress
function add_page_attributes_to_posts() {
add_post_type_support( ‘post’, ‘page-attributes’ );
add_post_type_support( ‘post’, ‘hierarchical’ ); // Optional, enables parent/child relationship
}
add_action( ‘init’, ‘add_page_attributes_to_posts’ );
The Page Attributes metabox allows you to set
- page parents
- templates,
- change the order of your pages.
Add Post parent
to posts wordpress hierarchical support
Custom Post Types with Hierarchical Support:
register_post_type( ‘your_custom_post_type’,
array(
‘labels’ => array(
‘name’ => __( ‘Your Custom Posts’ ),
‘singular_name’ => __( ‘Your Custom Post’ )
),
‘public’ => true,
‘has_archive’ => true,
‘hierarchical’ => true, // Enable hierarchical support
)
);
Permalink Manager Permastructure tags
%year%
, %monthnum%
, %day%
, %hour%
, %minute%
, %second%
, %post_id%
, %author%
, %search%
, %category%
, %post_tag%
, %post_format%
, %sitemap%
, %sitemap-subtype%
, %sitemap-stylesheet%
, %aiosrs-schema%
, %taxonomy%
, %post_type%
, %term_id%
, %monthname%
%post_type% permalink structure in wordpress = custom post type slug like book
post
post type’s properties:
add_action( 'registered_post_type', 'make_posts_hierarchical', 10, 2 ); function make_posts_hierarchical( $post_type, $pto ) { if ( 'post' === $post_type ) { global $wp_post_types; $wp_post_types['post']->hierarchical = true; add_post_type_support( 'post', 'page-attributes' ); } }
functions.php
file or a custom plugin, will make the default “Post” type hierarchical and add the “Page Attributes” meta box to the Post edit screen, allowing you to set a parent. Utilize Plugins.
Problem with post contnet generation need to fix further ..