Changing Custom Permalink with Filter
Changing Custom Permalink with Filter
Changing Custom Permalink with Filter
What you are looking for is called pretty permalink. You can set it in the WordPress’s settings. Head over to Settings > Permalinks. You will notice there are couple of options in the Common Settings section. What you want is a custom structure that isn’t available in the list. You have to add it yourself. … Read more
The reason that it’s an issue is because I’m using switch_to_blog() on a multisite. The post_type doesn’t exist on the current blog. It exists only on the main blog. Since the post_type doesn’t exist, the get_post_type_object() function is returning null. What I did to fix this is create a custom_get_post_permalink function that also takes a … Read more
Found the issue! Seems that the <Directory> in the .conf file in Apache2 was not configured correctly. An example of a correctly configured .conf file is as follows: # domain: exampleurl.com # public: /var/www/html/exampleurl.com/public_html/ <Directory /var/www/html/exampleurl.com/public_html> Require all granted AllowOverride All </Directory> <VirtualHost *:80> ServerAdmin [email protected] ServerName exampleurl.com ServerAlias www.exampleurl.com DocumentRoot /var/www/html/exampleurl.com/public_html ErrorLog /var/www/html/exampleurl.com/logs/error.log CustomLog … Read more
add_action( ‘init’, ‘wpa_category_base’ ); function wpa_category_base() { // Remember to flush the rules once manually after you added this code! add_rewrite_rule( // The regex to match the incoming URL ‘news/([^/]+)/([^/]+)/([^/]+)(/[0-9]+)?/?$’, // The resulting internal URL ‘index.php?category_name=$matches[1]/$matches[2]&name=$matches[3]&paged=$matches[4]’, // Add the rule to the top of the rewrite list ‘top’ ); } Custom permalink structure: /media/%category%/%postname%/ Category … Read more
Multilanguage URLs
Change permalink rule if category is called “uncategorized”
Changed URL formats to be like: /services/home-care/COUNTY/TOWN add_rewrite_rule( ‘services/([^/]*)/([^/]*)/([^/]*)/?’, ‘index.php?post_type=”ag_location”&ag_primary_inspection_cat=$matches[1]&ag_cities=$matches[3]’, ‘top’ ); add_rewrite_rule( ‘services/([^/]*)/([^/]*)/?’, ‘index.php?post_type=”ag_location”&ag_primary_inspection_cat=$matches[1]&ag_county=$matches[2]’, ‘top’ ); add_rewrite_rule( ‘services/([^/]*)/?’, ‘index.php?post_type=”ag_location”&ag_primary_inspection_cat=$matches[1]’, ‘top’ ); Based on this solution
http://wordpress.org/extend/plugins/custom-post-permalinks/ check this plugin, I’ve used it on a couple of sites and it works great.
By ‘existing page’ do you mean a WordPress page? My experience with rewrites is routing everything to index.php with whatever extra query vars you need, I think attempting to route it to edit is one of your issues, not entirely clear on your intent there. Go download Monkeyman Rewrite Analyzer if you don’t already have … Read more