Rewrite /keyword1+keyword2.html to search page | .htaccess

Don’t touch the .htaccess file, there’s this neat tool add_rewrite_rule() which you should hook into init: add_action(‘init’, function() { add_rewrite_rule( ‘search+([^/]+).html$’, ‘index.php?my_custom_search=1&s=$matches[1]&submit=Search’, ‘top’ ); }); Right after that you should flush the rewrite rules once ( by saving the permalink settings in Settings > Permalinks or with flush_rewrite_rules() BUT call that function only once and … Read more

Change url to posts if they have custom tax only

It works for me. add_filter(‘post_link’, ‘locale_permalink’, 10, 3); add_filter(‘post_type_link’, ‘locale_permalink’, 10, 3); function locale_permalink($permalink, $post_id, $leavename) { if (strpos($permalink, ‘%category_slider%’) === FALSE) return $permalink; $post = get_post($post_id); if (!$post) return $permalink; if ($post->post_type != ‘post’) { return $permalink; } else { $terms = wp_get_object_terms($post->ID, ‘category_slider’); if (!is_wp_error($terms) && !empty($terms) && is_object($terms[0])) $taxonomy_slug = $terms[0]->slug; else … Read more

How to use endpoint, but remove/rewrite endpoint base?

I think the add_rewrite_rule is the correct route to go and I think what you have is correct also barring the Regex. Try substituting what you have currently for this => ^my-page\/([0-9]+)\/?. Full code below: function setup_filter_rewrites(){ add_rewrite_rule(‘^my-page\/([0-9]+)\/?’, ‘index.php?pagename=my-page&my_var=$matches[1]’, ‘top’); } add_action( ‘init’, ‘setup_filter_rewrites’ );

Custom Post Type Rewrite – Page Not Found

If you are using this in a plugin, from the codex: To get permalinks to work when you activate the plugin use the following example, paying attention to how my_cpt_init is called in the register_activation_hook callback: add_action( ‘init’, ‘my_cpt_init’ ); function my_cpt_init() { register_post_type( … ); } function my_rewrite_flush() { // First, we “add” the … Read more

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