Rewrite Rule for homepage not working correctly

Two problems I see- rewrite rules need to set query vars that will result in a successful main query. Setting just a custom var like slide doesn’t parse to anything WordPress can load. Additionally, slide needs to be added to the recognized query vars for it to get parsed within a rule.

So, what would a rule look like that would load the front page posts in the main query? That’s a good question- the posts page is a special case, the absence of any other query vars. I haven’t found a way to do that with a rule, though it may exist.

An easier way to do this is with a rewrite endpoint:

function wpd_slide_endpoint(){
    add_rewrite_endpoint( 'slide', EP_ROOT );
}
add_action( 'init', 'wpd_slide_endpoint' );

Keep in mind that if you have code accessing values via $_GET, this still won’t work, because WordPress doesn’t put query vars there when rules are parsed. You can change the code to use get_query_var, or just assign it before the code tries to access it:

$_GET['slide'] = get_query_var('slide');

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