404 page is not the same when using PHP code in functions

template_include is a filter hook, so you are supposed to always return the full absolute filesystem path to a template, and not doing the get_template_part() and exit calls. And as for setting the 404 status, I would instead use the pre_handle_404 filter, but the wp action can also be used: (note that these examples are … Read more

Custom Post Type, 404 error

I solved by eliminating the following portion of code: I don’t remember why I had to code it, it apparently solved an issue, even if I don’t remember what issue. The portion is the following: add_action(‘pre_get_posts’, function ($query) { if (!is_admin() && $query->is_main_query() && empty($query->query_vars[‘suppress_filters’])) { if (is_archive()) { if (is_category()) { $query->set(‘post_type’, [‘post’, ‘docs’]); … Read more

Cannot Create a new Post [closed]

You can try each one of these: Go to WordPress Dashboard > Settings > Permalinks and simply hit Save Changes. Make sure there’s no index.html in your website’s root directory (i.e. the directory in which WordPress files are located). Create an .htaccess file in your wp-admin directory with the following contents: <IfModule mod_security.c> SecFilterEngine Off … Read more

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