How to disable a route or permalink in wordpress? - wordpress

In my wordpress dashboard I've got a link called "che passa". When I click on it, I can create articles and the route will be for example => "www.website.com/che-passa/test"
I need to disable the link "che-passa" and I really don't know how to do it. Are there any wordpress developpers here ?

I found the archive.php and I deleted all the code and replace it by =>
wp_redirect(home_url("")); exit(); And it work :)

Related

Don't redirect users to wp-comments-post.php instead show required directly in input fields

I am looking forward to 2 things:
Rename "wp-comment-post" to any other name
Don't redirect users to the wp comment error page.
I have found a website that shows comment error messages on the form without any redirection. I am looking forward to something like that.
I'm sharing 1 blog post of that website, when you scroll down to the comment form, you can discover that the error is showing on the form. Which looks really nice and simple.
Link: https://neilpatel.com/how-to-start-a-blog/
Please help me out with codes and which files to put those.
Thanks in advance!
I had the same issue. Check the code below within your theme and remove 'comment-form' and 'comment-list'.
add_theme_support(
'html5',
array(
'search-form',
//'comment-form',
//'comment-list',
'gallery',
'caption',
)
);
Note this question should be on WordPress stackoverflow.

Wordpress permalinks not redirecting in my new theme

I hope you can help me. I'm using /%postname%/ as permalink structure.
In the default theme everything working fine but in the new theme, default link '?p=123' does not redirect to the 'Post Name' link, and both links are working at the same time.
To clarify further... www.myblog.com/?p=123 does not redirect to www.myblog.com/some-blog-post. Both links are working, but no redirects are applied. This problem only occurs when this specific theme is enabled.
Any ideas?
Please edit your theme function.php and add following code.
code:-
add_action( 'after_switch_theme', 'thmf_flush_rewrite_rules' );
function thmf_flush_rewrite_rules() {
flush_rewrite_rules();
}

woocommerce pagination not working

On my locally hosted site is the woocommerce pagination not working properly.
When I use http://localhost/sample-post/ the second page is a wrong one. I'm landing on an attachment page instead of the second product page.
When using http://localhost/?p=123 it works ok.
Anyone an idea?
Is it because I'm working locally and will it not be on a remote server? I've read something about that. Need confirmation.
EDIT
Went worse.....
I have to translate the site in different languages using WPML. When using the default permalinks WPML complains. When using another structure (see above) and in WPML the setting for a different folder for each language I got pages with no result (except for a message from woocommerce that no products were found.
EDIT 2, February 18th, 2015
I start to wonder if it is even possible to set the WooCommerce shop page as the Front page. The support team of WooCommerce is puzzled as well and are wondering too if it is possible. I hope someone has experience with it or an example of a site on which it works.
Please, can anyone help me out here... I'm struggling now for a long time and I'm not able to solve this myself.
your permalinks settings need adjusting. in wp-admin go to settings>permalinks>common settings, and set "per post." check your product permalink base as well.
Please use this function for correct woocommerce pagination. please use this function inside the function.php
add_filter( 'woocommerce_pagination_args', 'rocket_woo_pagination' );
function rocket_woo_pagination( $args ) {
$args['prev_text'] = '<i class="fa fa-angle-left"></i>';
$args['next_text'] = '<i class="fa fa-angle-right"></i>';
return $args;
}

Hide Wordpress dashboard?

I'm new to wordpress and a bit confused with something. I'm trying to build a classified marketplace type of website for myself. I am NOT building this for a "client". I will probably be using a hack of several different plugins as my coding skills are not up to par. Eventually I will hopefully have lots of users who will be composed of buyers & sellers.
My question pertains to the WP dashboard. When buyers/sellers sign up for my site, will they be able to see the backend WP dashboard? I would prefer that they NOT be able to access a backend dashboard at all let alone a WP branded one. Is this possible? If so any clue as to how this might be accomplished?
thank you Brian
Normal users do not actually see the 'backend' WP dashboard. What they are seeing is a 'profile' type page meant for the original functionality of wordpres; being a blog.
If you do not want users to go to this page when they log-in, you can use a couple of hooks. Here is some code that redirects to the front page after logging-in and logging-out. This goes in your functions.php file.
add_action('login_form', 'ang_redirect_to_front_page');
add_action('wp_logout', 'go_home');
function ang_redirect_to_front_page() {
global $redirect_to;
if (!isset($_GET['redirect_to'])) {
$redirect_to = get_option('siteurl');
}
}
function go_home(){
wp_redirect( home_url() );
exit();
}
And, if your theme is still displaying the menu at the top of the screen that allows the users to go to this 'profile' area, you can go into your footer.php file and remove this:
<?php wp_footer();?>
However, if you do this, then you will not see it as the admin either.
WordPress is might not be the thing to use for that kind of website, even with a bunch of plugins. Read up on other content management systems just incase.
This link might answer your question:
http://buddypress.org/support/topic/how-to-prevent-non-admins-from-accessing-wp-admin-dashboard/
You can also add this to your theme's function.php file:
// DISABLE ADMIN BAR FOR ALL USERS
show_admin_bar( false );
If you are not too used to wordpress, use WOOCOMMERCE plugin. Its completely free and well documented

Rewrite category wordpress

Is it possible to rewrite only one category ?
I have a category "Photos" and just for this category.
I just want to rewrite it from /category/photos to /photos
You can do it with WP Rewrite API.
Add this to functions.php
add_action('init', 'register_rewrites');
function register_rewrites() {
add_rewrite_rule('^photos$', 'index.php?category_name=photos','top');
}
Remember to reload your rewrite settings: go to Settings -> Permalinks and click on Save button - no changes needed.
The Yoast SEO plugin has this function build in, I recommend this plugin in general.
no-category-base-wpml only does this
If you don't want to install a plugin for this. Around the web there are many tutorials which do this:
http://thisismyurl.com/6704/remove-category-url-wordpress/
http://www.webdevtuts.net/php/how-to-remove-category-from-wordpress-url-structure/
http://www.wprecipes.com/how-to-remove-category-from-your-wordpress-url
Too enable this for just one category I would advise the following:
create a page called photos.
create a theme template page for this photo page
In is set up a new query_posts* getting the category 'photos'
Include the category.php file.
assign that template to the photo page.
Not tested but should work. Because the page has the correct URL and should include the category. Questions, aks.
*query_posts is bad for performance if you want to do it totally correct use the pre_get_posts filter. It's requires more knowledge.

Resources