Add a product attribute to permalink in WooCommerce

You can do like this, to append QUERY to permalinks (not base url): add_filter( ‘post_type_link’, ‘my_append_query_string’, 10, 4 ); function my_append_query_string( $permalink, $post, $leavename, $sample ) { if ( $post->post_type == ‘shop’ ) { if (get_option(‘permalink_structure’)){ $permalink = AddStringToUrl($permalink,’color=red’); } } return $permalink; } function AddStringToUrl($current_url, $string) { return $current_url . ( stripos($current_url, ‘?’) === … Read more

Permalink Options does not change

Make sure your Apache web server have mod_rewrite. Create .htaccess on your wordpress root directory with following content (or add these to existing .htaccess file): # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\.php$ – [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule> # END WordPress

Post permalinks go to the home page

For repairing htaccess in WordPress all you need is to delete this file and then enter wp-admin -> settings > permalinks > save. But i’m still not sure i understand the problem you are having.. If i understand, when friendly urls are on you get blank posts but not pages and when you are using … Read more

Pretty Filter URL

Here is my current code: function hm_base_date_query_vars($vars) { $vars[] = ‘base_date’; return $vars; } add_filter(‘query_vars’, ‘hm_base_date_query_vars’); function hm_base_date_rewrite_rule() { add_rewrite_rule( ‘^my-calendar/([^/]*)/?’, ‘index.php?pagename=my-calendar&base_date=$matches[1]’, ‘top’ ); } add_action(‘init’, ‘hm_base_date_rewrite_rule’, 10, 0); $base_date_test = get_query_var(‘base_date’); on the url example.com/my-calendar/foo my var $base_date_test returns null Maybe someone can help me. Thanks. // Edit: It works. I tried to call … Read more

wp_dropdown_categories links 404

Here is the answer I was looking for. Staring me right in the face. I have managed to fix this issue with a simple addition to the code. &value_field=slug So final code which works and maybe of help in the future. <form action=”<?php bloginfo(‘url’); ?>/” method=”get”> <label for=””>Search.</label> <?php $select = wp_dropdown_categories( ‘taxonomy=YOURTAXONOMY &name=YOURTAXONOMY &show_option_all=Please … Read more

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