Remove custom taxonomy base from URL

Depending on how you are registering your custom post types, you can simply set the rewrite rules for it like so: $args = array( ‘description’ => ‘Photograph Post Type’, ‘label’ => __(‘Photographs’), ‘public’ => true, ‘rewrite’ => array( ‘slug’ => ‘photograph’), ); register_post_type( ‘photograph’ , $args ); If (for some bizarre reason) you don’t have … Read more

RewriteRule accepts numbers but not letters in tag

Leave .htaccess alone. You can use WordPress rewrite API for this. add_action( ‘init’, function(){ return add_rewrite_rule( ‘subdir/([^/]+)/?$’, // ([^/]+) takes alphanumeric, while ([0-9]+) accepts digits ‘index.php?pagename=subdir&website=$matches[1]’, ‘top’ ); }); add_filter(‘query_vars’, function($v){ return array_merge(array(‘website’),$v); }); First make sure subdir is a valid page slug, in this example. After you save that code to your child theme’s … Read more

301 Redirects Result in 404 for WordPress Search Query Strings

Redirect 301 /search?q=avengers https://www.example.com/?s=avengers You can’t match the query string with a mod_alias Redirect (or RedirectMatch) directive. The Redirect directive matches the URL-path only. You need to use mod_rewrite and match against the QUERY_STRING server variable. For example: RewriteCond %{QUERY_STRING} ^q=avengers$ RewriteRule ^search$ /?s=avengers [R=301,L] This will need to go before the existing WordPress front-controller. … Read more

WordPress get permalink function

From https://developer.wordpress.org/reference/functions/get_permalink/ : get_permalink( int|WP_Post $post, bool $leavename = false ) Retrieves the full permalink for the current post or post ID. […] Note that when used outside The Loop on a posts page (index, archive, etc.) without the ID parameter, it will return the URL of the last post in The Loop, not the … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)