When a link doesn’t exist, how to tell WordPress what to do? (404 Error Page)

The conditional you use to output get_template_part('content', 'none'); is only triggered if there is no post in the main loop, for example, when a category has no posts in it:

if (have_posts()){
    while(have_posts()) {
        the_post();
        // If the category has a post and we are on a category page, then show the posts
        get_template_part('content', 'archive');
    }
} else {
    //If the category has no posts, display a message that no post exists
    get_template_part('content', 'none');
}

But this only happens when you visit www.example.com/category/some-cat/, and the /some-cat/ is actually an existing category slug. If you try to access a page that doesn’t exist, the 404.php template will be used instead.

deneme bonusu veren sitelerbahis casinomakrobetceltabetpinbahispolobetpolobet girişpinbahis girişmakrobet girişpulibet girişmobilbahis girişkolaybet giriş