Category url; have it only answer to 1 category

Here’s how I did to fix it. Added this to my functions.php $url = $_SERVER[‘SERVER_NAME’].$_SERVER[‘REQUEST_URI’]; if($_SERVER[‘HTTPS’]){ $url=”https://”.$url; }else{ $url=”http://”.$url; } $id = url_to_postid( $url ); $url = parse_url($url,PHP_URL_PATH); $canonical = parse_url(wp_get_canonical_url($id),PHP_URL_PATH); if($url != $canonical){ wp_redirect(wp_get_canonical_url($id),302); } Basically if I hit an url that is not its own canonical, force a redirect. @Tom J Nowell, weird … Read more

How to add .html extension only to pages without child pages?

I think you can achieve the desired functionality by selectively adding the .html extension to specific pages using a custom rewrite rule and the page_link filter. // Add a custom rewrite rule to handle pages with .html extension function custom_html_page_rewrite_rule() { add_rewrite_rule( ‘^([^/]+)(\.html)/?$’, ‘index.php?pagename=$matches[1]’, ‘top’ ); } add_action(‘init’, ‘custom_html_page_rewrite_rule’, 10); // Filter page links to … Read more

How to remove parent slugs from child pages permalinks?

To remove parent slugs from child pages’ permalinks in WordPress and avoid the 404 error, you’ll need to modify your code and add some rewrite rules. First, modify your code to remove the parent slug from the child page’s permalink: function my_pages_permalink($link, $post) { if ($post->post_parent) { $parent = get_post($post->post_parent); $link = trailingslashit(home_url($parent->post_name)) . $post->post_name … Read more

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