Tag Info

New answers tagged

2

I used the WooCommerce API and this code: <?php set_time_limit(0); // Include the client library require_once 'class-wc-api-client.php'; $consumer_key = 'XXXX'; // Add your own Consumer Key here $consumer_secret = 'XXXX'; // Add your own Consumer Secret here $store_url = 'http://www.example.com/'; // Add the home URL to the ...


0

You could use the Rewrite API. Since you have a fixed set of posts you could do the following: add_action( 'init', 'rewrite_old_slugs' ); function rewrite_old_slugs(){ $post_slugs = array( 'post-1' => 1, 'post-2' => 2 ); foreach( $post_slugs as $slug => $new_id ) add_rewrite_rule( $slug . '?$', 'index.php?p=' ...


0

Add the value you want before the "meaningful" url variables (city, area, etc) to the slug like this: "uk/([^/]*)/([^/]*)/?$" => 'index.php?city=$matches[1]&area=$matches[2]&something=$matches[3]', This way it will only "capture" those URL variables (city, area) if "uk" is at the beginning. A more complete example might look like this //Set ...


3

The redirect is thanks to redirect_canonical() - we can simply swoop in with a filter and disable it for the front page: function wpse_184163_disable_canonical_front_page( $redirect ) { if ( is_page() && $front_page = get_option( 'page_on_front' ) ) { if ( is_page( $front_page ) ) $redirect = false; } return ...


0

If i have understood you correctly you just need your domain.com/home to display your homepage too? Just create this in a folder called home in the same folder as your /wp-content etc Name it index.php ?php header("Location: http://domain.com"); exit(); ?>


0

Try adding Options +FollowSymLinks to the top of the .htaccess file. If that doesn't work, verify that the host has AllowOverride enabled. Verify what they have the AllowOverride set to. mod_rewrite can be used to simulate a symbolic link. This is why mod_rewrite requires FollowSymLinks to be enabled, because it's a similar security thing. So if your host ...


0

Are you sure the rewrite module is enabled? Type: a2enmod rewrite If you are on Linux or equivalent for your platform/setup. You can also try: ls /etc/apache2/mods-enabled/ and look for the rewrite module in there?


0

Use a slash as value for slug... 100% working 'rewrite' => array( 'slug' => '/', 'with_front' => FALSE ),


2

This (in your functions.php) will turn it off (but see also the comment I've left): remove_action('template_redirect', 'wp_old_slug_redirect');


1

The publish_{post-type} action is triggered only when the post change from any post status (not published) to published; for example, if the post is already published and you edit it, the publish_{post-type} action is not triggered. I think you need to hook your function to save_post_{post_type} action, which is triggered every time a post is saved, not ...


-3

You could just do a display:none on the css selector for the slug so they never see it.


1

a multi site approach wouldn't work since you will be creating multiple blogs, each will work as an individual WP installation, so each of them will hold multiple posts, pages, categories, etc that are not shared between blogs. The url you are proposing can't be defined using wordpress routing, so a custom code will need to be developed for this approach.


0

I have managed to get this working using a rewrite, adding a query_var and doing some condiditional checking in my template file. I will post the code below that I used but although this works and seems to be working very well, It does not feel like the best way of doing it. If someone know of a better way of doing this please post the answer. I used this ...


0

I had the same problem and did everything that is normally suggested (empty trash etc)..I found the problem was that I had an image in the gallery with the same name as the page. Deleted the image, uploaded it with a new name and the problem disappeared.


0

Natively every post in WordPress has one specific permalink (if any and not counting non–pretty arguments–based shortlinks). This makes sense not just to WordPress, but also to other entities like people and search engines. It is certainly possible to make additional URLs to load posts in WP too. However it won't help you any with that. You would have to: ...


1

If there is no clear evidence of any present redirect from the following sources: The htaccess, both under the public_html and under the public_html/folder (where folder is the directory having all the wp files), removing and regenerating them by mean of updating the permalinks, The .htaccess files were at some point deleted, and regenerated, The domain ...


0

I have install "Advance Permalink" plungin by John Godley, on 31st March' 2015 for redirect me previous permalink structure of http://punch2crunch.com After 36 hours my all cotegories start creating automatically 404 errors and one category working but sick to single post. If this same is happening with you then you have to paste a thing only. Follow the ...


0

There is a option to mention your site address in General Settings. I think that is what you need to change.


1

What I ended up doing was setting up an endpoint for food, like so: global $wp_rewrite; $wp_rewrite->add_endpoint( 'food', EP_PERMALINK | EP_PAGES ); $wp_rewrite->flush_rules(); function printview_query_vars($vars) { array_push($vars, 'food'); return $vars; } add_filter('query_vars','printview_query_vars'); Then I'd get a url like ...


0

This code displays takes get_permalink() on a single page and get_home_url() on the homepage. If a link is found the Share-Link will be displayed. So the Link wouldn't be displayed right now on a category-page for example. <?php if( is_home() ){ $link = urlencode( get_home_url() ); $title = urlencode( get_bloginfo( 'title' ) ); ...


0

I would do as @cfx suggested: register_taxonomy( // Call before register_post_type() to give rewrite rule priority. 'bike_category', // Should be singular, not bikes_category 'bike', array( 'rewrite' => array( 'with_front' => false, // This will strip the "blog" prefix 'slug' => 'bikes', ), ...


0

The rewrite rules are wrong. For example, you want to rewrite from community/tag/easter to 'index.php?pagename=community&stencil-tag=easter', so the regex should contain community/tag/ and not only tag/. Also, \d match only digits but the tag value is a string. Same apply to the rewrite for stencil-tag. You could use . to match any character, both ...


0

Use this plugin in wordpress and write rule which will overwrite nginx rule. https://wordpress.org/plugins/rewrite/ When you have wordpress, you have to set permalink to default to work your webserver rule work and if you dont want to do that you have to install above plugin and write rule.


1

Unfortunately no. The filename is hard-coded into the core WordPress function with no way to override it by way of filters or other hooks.


0

a quick search shows another stackexchange topic on this, and it used this code to cleanup the permalink of parents/ancestors: function wpse_101072_flatten_hierarchies( $post_link, $post ) { if ( 'page' != $post->post_type ) return $post_link; $uri = ''; foreach ( $post->ancestors as $parent ) { $uri = get_post( $parent ...



Top 50 recent answers are included