How much control do we have over CPT rewrite slugs? Can I create a “root” page for my CPT with out the page path, and then have paths for other pages?

The way I see it, you could do: // Via the init hook, do all these: register_post_type( ‘library-books’, [ ‘public’ => true, ‘label’ => ‘Library Books’, ‘rewrite’ => [ ‘with_front’ => false, ‘slug’ => ‘library/books’ ], ‘has_archive’ => ‘library/books’, // other args here ] ); register_post_type( ‘library’, [ ‘public’ => true, ‘label’ => ‘Libraries’, ‘rewrite’ … Read more

Is there anything built into the WordPress core to enable me to get the relative path from the “permalink structure” option

Is there anything built into the WordPress core to enable me to get the relative path from the “permalink structure” option No, because it isn’t necessary, PHP provides this via parse_url. Using php -a we can launch an interactive PHP shell and test the code: php > echo parse_url( ‘http://example.com/iamapost/100’, PHP_URL_PATH ); /iamapost/100 php > … Read more

wordpress wp_list_categories

Hi @matt ryan: Simplest way to do what you want is to use PHP output buffering. I haven’t tested it yet but this should work: ob_start(); wp_list_categories( $args ); $html = ob_get_clean(); echo str_replace(get_bloginfo(‘wpurl’),”,$html); UPDATE You could also using the ‘wp_list_categories’ hook like this: add_action(‘wp_list_categories’,’mysite_wp_list_categories’); function mysite_wp_list_categories( $output ) { return str_replace( get_bloginfo(‘wpurl’),”, $output ); … Read more

Multi-site: removing /blog from posts

Let see if I remember this correctly. Go to http://yoursite.com/wp-admin/options.php Find permalink_structure. By default, the value should be /blog/%year%/%monthnum%/%postname%/ Change the value manually to whatever value you like. e.g /pressreleases/%year%/%monthnum%/%postname%/ or just /%year%/%monthnum%/%postname%/. Then Save Changes. Now visit http://yoursite.com/wp-admin/options-permalink.php and DON’T click Save Changes. It should flush the rules. If you click Save Changes it … Read more