How to Detect That WP is Using Mod Rewrite or $_GET variables?

You can check for the permalink_structure option value. If this value is an empty string, WP is using the default permalink structure (/?var1=val1&var2=val2), otherwise WP will be using the pretty permalink structure (/val1/val2): if (” != get_option(‘permalink_structure’)) { // pretty permalink ‘/val1/val2’ … } else { // default permalink ‘/?var1=val1&var2=val2’ … }

Creating a folder structure

I don’t think what you want is URL rewriting. If I understand correctly, what you want is to restrict access to certain pages, posts, categories, etc., based on the current user’s role or capabilities: “If logged in, do something. If not, do something else (like prompt to login or register).” Modifying the output/behavior of a … Read more

Get logged in username in wordpress url

I think this will do what you are looking for. add_action(“template_redirect”, ‘template_redirect’); function template_redirect() { global $wp; if(is_user_logged_in() && !isset($_GET[‘user’])){ $current_user= get_userdata(get_current_user_id()); wp_redirect(add_query_arg(array(‘user’=>$current_user->user_login),home_url($wp->request))); die(); } }

WP Rewrite for a custom variable

You have to use this: add_rewrite_rule( ‘resources/audience/([^/]+)/?$’, ‘index.php?pagename=resources&audience=$matches[1]’, ‘top’ ); in your init hook. Then you should add your own query variable: function add_my_var($public_query_vars) { $public_query_vars[] = ‘audience’; return $public_query_vars; } add_filter(‘query_vars’, ‘add_my_var’); Then flush rewrite rules (go to permalink settings and push “save” button). After visiting url: site.com/resources/audience/teachers/ your recources page should be shown. … Read more

Why is a rewrite rule in wordpress prevent pagination?

I changed: add_rewrite_rule(‘^brand-list/([^/]*)/([^/]*)/page/([0-9]+)?’,’index.php?pagename=brand-list&brand=$matches[1]&section=$matches[2]&paged=$matches[3]’,’top’); to: add_rewrite_rule(‘^brand-list/([^/]*)/([^/]*)/page/?([0-9]{1,})/?$’,’index.php?pagename=brand-list&brand=$matches[1]&section=$matches[2]&paged=$matches[3]’,’top’); Note the difference is /page/([0-9]+)? is now /page/?([0-9]{1,})/?$ seems to be working now.

Mobile version and URL Rewrite

You can change the options siteurl and home. add_action(‘after_setup_theme’, ‘maybe_mobile_url’); function maybe_mobile_url() { if ( wp_is_mobile() ) { add_filter(‘option_siteurl’, ‘add_mobile_url’ ); add_filter(‘option_home’, ‘add_mobile_url’ ); } } function add_mobile_url ($url) { return $url . ‘/mobile’; } But, I think, that if you define WP_SITEURL and/or WP_HOME in config.php it will fail, and you will have to … Read more

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