Wrong generated page_name/slug on first publish of custom post type

When registering or updating any rewrite for any post/custom post type you need to flush rewrite rules by the admin panel or via code: register_activation_hook( __FILE__, ‘plugin_activation’ ); function plugin_activation() { update_option(‘plugin_permalinks_flushed’, 0); } add_action( ‘init’, ‘register_custom_post_type’ ); function register_custom_post_type() { global $wp; register_post_type( ‘review’, array( ‘label’ => ‘Reviews’, ‘labels’ => array( ‘name’ => ‘Reviews’, … Read more

Permalinks for parent/child pages and custom post types

Disable the with_front on rewrite while register_post_type. In your case: register_post_type(‘news’, array( … ‘public’ => true, ‘rewrite’ => array(‘slug’ => ‘news’, ‘with_front’=> false), ‘supports’ => array( ‘title’, ‘page-attributes’, ‘editor’, ‘custom-fields’) ));

WordPress Permalinks still not working despite all necessary settings

Since the domain/site has an ssl, the vhosts file for the ssl is separate and also needs to be updated. Not just the normal port 80 entry. vhost (:80) my-wp-site.com.conf <VirtualHost *:80> … DocumentRoot /home/ubuntu/sites/my-wp-site.com … <Directory /home/ubuntu/sites/my-wp-site.com> Options Indexes FollowSymLinks AllowOverride All Require all granted </Directory> … </VirtualHost> vhost (:443) my-wp-site.com-le-ssl.conf <IfModule mod_ssl.c> <VirtualHost … Read more

Need Help Correct Regular Expression Redirect Code

At the top of your .htaccess file, before your existing WordPress directives, you could do something like the following to redirect the old permalink: RewriteRule ^\d{4}/\d\d/([\w-]+\.html)$ /$1 [R=301,L] The RewriteRule pattern matches against the URL-path less the slash prefix. \d{4}/ – matches the 4-digit year, followed by a slash. \d\d/ – matches the 2-digit month … Read more

Permalinks for pages

You can make each page a parent of one another. To assign a parent page to a page, navigate to the page you want to assign a parent page too, then in the right sidebar you will see Page Attributes and a dropdown menu labelled Parent, whatever page you selected in that list will become … Read more