WordPress Attachment Page URL Rewrite!

There are three issues in your code: In your custom wp_attachment_link() function, you should use the post slug ($attachment->post_name) instead of simply replacing the (whitespaces) with – (dash) in the post title — and note that the resulting slug could be different than the actual slug, e.g. the title could be My Image with the … Read more

Convert $ _GET to permalink

Probably the easiest way to solve this would be to add classes to your body tag based on the value of the parameter. You would just want to be sure to sanitize it. You can add classes to the body using the body_class filter which feeds in all the current classes as an array. You … Read more

Whole site’s pagination not working after rewriting product permalink

I managed to get it fixed with the advice from tom. This is the solution I tried. function product_perma_Rewrite() { $prodCat = [‘taxonomy’ => ‘product_cat’]; $categories = get_categories($prodCat); $catSlug = []; foreach($categories as $category) { $catSlug[] = $category->slug; } add_rewrite_rule( ‘^(‘.implode(‘|’, $catSlug).’)/([^/]+)/comment-page-([0-9]{1,})/?$’, ‘index.php?post_type=product&category=$matches[1]&product=$matches[2]&cpage=$matches[3]’,’top’ ); add_rewrite_rule( ‘^(‘.implode(‘|’, $catSlug).’)/([^/]*)/?’, ‘index.php?post_type=product&category=$matches[1]&product=$matches[2]’, ‘top’ ); flush_rewrite_rules(); } add_action(‘init’, ‘product_perma_Rewrite’);

remove SLASH on single_post but KEEP on categories and parent pages

After SO MANY research, I found a Great Simple solution via https://stackoverflow.com/a/54251892/10403689 (vote this ⬆UP⬆) Your Permalink Structure should be: /%category%/%postname%/ function no_post_slash( $string, $type ){ if($type == ‘single’) $string = untrailingslashit($string); return $string; } add_filter(‘user_trailingslashit’, ‘no_post_slash’, 70, 2); BUT this is only working on single_post not pages

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