WordPress .htaccess – route other URLs to another app

Since your WordPress site is just a one-page site, this is served from the single URL http://example.com/. You then want http://example.com/<something> to be internally rewritten to http://example.com/app/<something>. You can add the following mod_rewrite directives before your existing WordPress directives (ie. WordPress front-controller) in your root .htaccess file: # Route all URL-paths (of 1 or more … Read more

Flush Rewrite Rules on init or rest_api_init?

Flushing rewrite rule should not be done on routine basis, as stated per codex: Don’t do it on any hook that will triggered on a routine basis. You should either do it via the plugin activation hooks, or the theme switch hooks: add_action( ‘after_switch_theme’, ‘wpse315001_flush_rewrite_rules’ ); register_deactivation_hook( __FILE__, ‘wpse315001_flush_rewrite_rules’ ); register_activation_hook( __FILE__, ‘wpse315001_flush_rewrite_rules’ ); function … Read more

Define orderby in url

adding this in the functions.php file works. Just remember to re-save your permalinks & empty the cache a few times to see the changes. add_action( ‘init’, ‘wpse13483_init’ ); function wpse13483_init() { add_rewrite_rule( ‘category/(.+?)/orderby/([^/]+)?/?$’, ‘index.php?category_name=$matches[1]&orderby=$matches[2]&order=asc’, ‘top’ ); add_rewrite_rule( ‘category/(.+?)/orderby/([^/]+)/order/([^/]+)?/?$’, ‘index.php?category_name=$matches[1]&orderby=$matches[2]&order=$matches[3]’, ‘top’ ); // with pagination; add_rewrite_rule( ‘category/(.+?)/orderby/([^/]+)/order/([^/]+)/page/([0-9]{1,})?/?$’, ‘index.php?category_name=$matches[1]&orderby=$matches[2]&order=$matches[3]&paged=$matches[4]’, ‘top’ ); }

Permalink Rewrite for Custom Taxonomy

There are a few parts to making this work. First, we register the taxonomy: function wpa69163_register_txonomy() { register_taxonomy(‘board’, ‘post’, array( ‘labels’ => array( ‘name’ => _x( ‘Boards’, ‘taxonomy general name’ ), ), ‘rewrite’ => array( ‘slug’ => ‘board’, ‘with_front’ => false ) )); } add_action( ‘init’, ‘wpa69163_register_txonomy’, 0 ); Next, we have to add a … Read more

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