site url - How to Convert Parent Page's URL in Singular Name format when Child page is open

admin2025-01-08  4

I am trying to Convert the Parent Page URL into Sinular Name format when the child page is open, for instance:

Parent Page: abc/courses 
The child Page Should be: abc/course/course-name 

(Required this format when child page open removed s from parent name URL only).

I don't need this format to create another page with the course name redirecting to courses and call the child page's parent course.

I am trying to Convert the Parent Page URL into Sinular Name format when the child page is open, for instance:

Parent Page: abc.com/courses 
The child Page Should be: abc.com/course/course-name 

(Required this format when child page open removed s from parent name URL only).

I don't need this format to create another page with the course name redirecting to courses and call the child page's parent course.

Share Improve this question edited Nov 26, 2024 at 11:46 Islamic Quran Center asked Nov 26, 2024 at 11:41 Islamic Quran CenterIslamic Quran Center 13 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 1

When registering your CPT, the rewrite and has_archive parameters will control the URLs (untested):

register_post_type( 'course', array(
    ...
    'rewrite' => array(
        'with_front' => false,
        'slug'       => 'course',
    ),
    'has_archive' => 'courses',
);
转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1736266545a1129.html

最新回复(0)