Redirect user if it’s not logged in

I wouldn’t use htaccess for that. What I would do is make a ‘download page’ template and use it to ‘serve’ the files. By doing that, I can do a check with is_user_logged_in() Codex and redirect with wp_login_url() Codex Just do: if ( is_user_logged_in() ) : //file link else : wp_login_url(); endif; I think it’s … Read more

How to make variables in URL look like the permalink structure?

The following two functions should point you in the right direction: function wpse49393_query_vars($query_vars) { $query_vars[] = ‘myvar’; return $query_vars; } add_filter(‘query_vars’, ‘wpse49393_query_vars’); function wpse49393_rewrite_rules_array($rewrite_rules) { $rewrite_rules[‘path/to/page/([^/]+)/?$’] = ‘index.php?pagename=path/to/page&myvar=$matches[1]’; return $rewrite_rules; } add_filter(‘rewrite_rules_array’, ‘wpse49393_rewrite_rules_array’); I would give credit where it is due, but I cannot remember where I originally found this code. I just pulled this … Read more

Permalinks all messed up, I am helpless [closed]

There are probably more problems with your question than with WordPress. To get an insightful answer, it’d help to get us a clear idea about your setup. Don’t be shy about hiding your website link and it’s structure. This can help us figure it out. To get the rewrite rules of your blog add_action (‘template_redirect’, … Read more

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