New answers tagged

1

This is possible, if a little involved. To achieve this you will need: A custom query var. A filter that sorts results based on the query var. A rewrite rule for the archive that applies the query var for your pretty URL. Another rewrite rule for the same thing, but including pagination. Check for the query var to apply changes to any other parts of the ...


0

I don't know what nepal is (text prefix only or maybe taxonomy term), but it is not the most important thing, you will correct it if necessary. Rewrite rule like this should resolve the case. add_action( 'init', 'se356109_events_custom_rule' ); function se356109_events_custom_rule() { add_rewrite_rule( 'nepal/events/(.+?)/([0-9\-]+)(:?/page/?([...


0

In the past I have made it with https://developer.wordpress.org/reference/functions/add_rewrite_rule/ The best solution, with a simple regexp can read and detect all parameters in your URL and rewrite to show the correct post


0

I went to the dashboard main options and changed the paths WordPress Address: www.mysite.com/wp/ Site Address: www.mysite.com/ or www.mysite.com/news/ You should only update the Site Address (URL). If you update the Wordpress Address (URL) then Wordpress is looking for the files in the wrong directory hence the 404. Check out this Wordpress Page for ...


0

It's a bit of a trick to get a Wordpress site working within a framework of a non-Wordpress (html only) site in a fully-integrated way (though it can be done!). To keep things simple, I'd keep them pretty separate for the moment, which it sounds like you're happy to do. So I guess you have two main options to clean things up and get it working on your ...


0

Ah, you've discovered attachments :) The media library isn't a file browser, and things that get put in the uploads folder don't just appear in the media library either. Did you never wonder how WordPress stored the titles and captions for images? When you upload a photo, aside from the physical file, WordPress creates a post of type attachment. As we know,...


-1

In my case it was missing rights in my development folder so .htaccess file could not have been created ad/or modified. So manual flushing or Saving changes in WP Permalinks was not helping. Solution was to create .htaccess file by myself


0

At the beginning I will indicate that the expected structure conflicts with the default for custom post type produce posts. The solution to the problem requires changing the links created for the custom categories and appropriate parsing of new links to display the right posts. Use the pre_term_link filter to change links. One of the parameters passed ...


0

You can only do that if the user is logged in (otherwise there is no "current" user). Depending on what your specific use case is, it would be something like this: if ( is_user_logged_in() ) { global $current_user; $current_user = wp_get_current_user(); // get the username: $username = $current_user->user_login; // set up the URL: ...


0

Did you try to filter the $wp_query object? You can use this code snippet to search for the category slug directly in DB: function pm_detect_term_slugs($query) { global $wpdb; // Do not run when Elementor is opened if((!empty($_REQUEST['action']) && strpos($_REQUEST['action'], 'elementor') !== false) || isset($_REQUEST['elementor-...


0

Try to rewrite the taxonomy url in the .htaccess RewriteRule ^produce_category(.*)$ /$1 [L] (Not tested)


0

If you are using Apache then add the following to the end of .htaccess in the root of your WordPress installation. This will perform the redirection automatically for you. Note: Replace http://www.example.com with your site URL. RewriteRule ^category/(.+)$ http://www.example.com/$1 [R=301,L]


0

Sometimes you need to write new actions. To solve the category base problem you need to add and remove some actions. You can try this code as a custom plugin. Probably this can solve your problem. The code completely removes /category/ base. Add this code to your theme's functions.php or create a custom plugin with this code. /** * Add some actions to ...


Top 50 recent answers are included