Tag Info

New answers tagged

1

It's generally consider pretty bad practice to have the same content at different URLs on a site and will probably damage your search engine performance. Bear in mind you'll likely need to use a rel="canonical" link tag in your page header pointing to one of the three possible URLs. Also Wordpress stores many links directly in its database and these also ...


0

I used the following functions to solve this problem. //This adds a custom query variable to the permalink function add_custom_query_var( $vars ){ $vars[] = "shop_name"; return $vars; } add_filter( 'query_vars', 'add_custom_query_var' ); function add_rewrite_rules($aRules) { $aNewRules = array('shop/([^/]+)/?$' => ...


0

You can add this in your functions.php: global $wp_rewrite; $wp_rewrite->author_base = "member"; // or whatever $wp_rewrite->flush_rules();


0

10up engineering best practices as a great example on how to achieve that. You basically add a new rewrite tag and a new rewrite rule and then using the template_redirect action you return your custom action. Here is the code: add_action( 'init', function() { add_rewrite_tag( '%model%', '([^/]+)' ); add_rewrite_rule( 'cars/([^/]+)/?', ...


0

yes we can hide category by using plugin yoast seo got to advanced of seo and in that go to permalinks mark up the 1st option Strip the category base (usually /category/) from the category URL " and save its all done now


0

It should work with this lines which simply remove the .php from files that end with .php: RewriteCond %{REQUEST_FILENAME}.php -f RewriteRule !.*\.php$ %{REQUEST_FILENAME}.php [QSA,L]


1

You need to flush rewrite rules after adding or modifying rewrite rules in WordPress. flush_rewrite_rules() can be used to flush rules. For more info check these links : https://codex.wordpress.org/Rewrite_API/add_rewrite_rule https://codex.wordpress.org/Function_Reference/flush_rewrite_rules


0

I found the answer myself - so here is the update to above problem: Custom post type registration: function create_post_type_mycustomname() { $args = array( 'capability_type' => 'post', 'has_archive' => 'mycustomname', 'rewrite' => array( 'slug' => '/mycustomname', 'feeds' => false ...


0

You need to create a new permalink and after to set some rewrite rules. The function add_permastruct is a good start. You can find a good example here: http://shibashake.com/wordpress-theme/wordpress-permalink-add That's a media library example, but you can use the same functionality for your language module.


1

1.Login as the admin in WordPress. 2.Go to the Settings tab. 3.Go to the Reading tab. 4.Change the Blog pages show at most from the default 10 to any number *less than 10. For example, 5. 5.Save the changes. 6.View the blog. Hope that helps.


0

I actualy managed to do that with add_rewrite_rule(); just before add_rewrite_rule() you need to use flush_rewrite_rules() function, and it works.


0

Have you thought of making post type, taxonomy, terms? If you do so, it will be a lot easier for you to code and get the above urls. If any confusion, let me know.


1

I think you can create a rewrite rule for each "region" to don't overwrite other important rules you could need (like pages, categories, etc..). I was playing with your code examples and with a small change in rewrite_resets could work: public function rewrite_resets() { global $wp_rewrite; foreach($this->ENABLED_POST_TYPES as $post_type) { ...


1

Update You can make use of the add_rewrite_endpoint: add_rewrite_endpoint( 'schools', EP_PERMALINK | EP_PAGES ); You can then check in the sidebar for the schools variable: global $wp_query; if ( isset( $wp_query->query_vars['schools'] ) ) { // ... } What is worth mentioning is that your URL will look like ...


0

@GrSrv It is not possible in vanilla WordPress as the tags, and categories are separate entities. Categories would offer you a hierarchical parent/child relationship, and could accomplish this. CategoryParent1 CategoryChild1 CategoryGrandchild1, CategoryGrandchild2, CategoryGrandchild3 CategoryParent1 CategoryChild2 CategoryGrandchild1, ...



Top 50 recent answers are included