Need to add rewrite rule that adds in additional information about the post to url

Sorry I took so long to write this up. Hope it’s still useful. This is based off of a tutorial found here and some general playing around. <?php //This function sets up the permastructure add_action(‘init’, ‘setup_permastruct’, 40); function setup_permastruct() { //Setup query vars add_rewrite_tag(‘%state%’,'([^/]+)’); add_rewrite_tag(‘%suburb%’,'([^/]+)’); //Permastruct for custom post type add_permastruct(‘venue’, ‘venue/%state%/%suburb%/%postname%’, false); } //This … Read more

.htaccess rewrite

It looks like you need to process the rewrite using query strings rather than a URI segment and pass your query through index.php. WordPress seems to be agnostic of what you’re trying to accomplish here. Try the following rule and visit your Settings->Permalinks page to flush previous rules and add this to the stack. add_rewrite_rule( … Read more

Monkey Man Rewrite Analyzer says my rule will trigger but it doesn’t [closed]

Honestly, can not debug your code, but this one works: function register_crr_jsonwebservice( $wp_rewrite ) { //Add the rewrite rule for this specific json controller add_rewrite_tag( ‘%ticket%’, ‘([a-zA-Z0-9]+)’); $wp_rewrite->rules = array( ‘cjson/fullticket/?([a-zA-Z0-9]{1,})/?$’ => $wp_rewrite->index . “?page_id=243&ticket=”.$matches[1] ) + $wp_rewrite->rules; } add_action( ‘generate_rewrite_rules’, ‘register_crr_jsonwebservice’ ); Do not call flush_rewrite_rules(); from this function – will lead to an … Read more

WordPress Rewrites – How can I pass a variable to Custom Post Type?

You can use add_rewrite_endpoint, which will add a query var and generate the necessary rewrite rules: function wpd_cid_endpoint() { add_rewrite_endpoint( ‘cid’, EP_PERMALINK ); } add_action( ‘init’, ‘wpd_cid_endpoint’ ); Don’t forget to flush rewrite rules after changing rules. You can do this quickly by visiting the Settings > Permalinks page in admin.

WP is ignoring .htaccess rewritten URL

RewriteCond %{HTTP_HOST} dom1 [NC] RewriteRule ^((about\-us|etc).*) /dom1/$1 [NC,QSA,L] Your rewrite rule includes the L parameter, which makes it stop processing rewrites. So WordPress’s rules to redirect to index.php likely never come into effect. Which means WordPress is not even being run here. The 404 is likely from the webserver saying that the file at /dom1/about-us … Read more

Custom rewrite_rules – only pass numbers and not alphabetic characters

Instead of index.php/reco/?b=$1, try this: “$wp_rewrite->index?pagename=reco&b=” . $wp_rewrite->preg_index( 1 ) You should also append a $ to your reco/([^/]*)/? regex to ensure the rule only matches the entire path, and not just the beginning. Then flush your rules afterwards (just re-save your permalink settings in admin). Update: Try using the page_rewrite_rules filter instead, and use … Read more

Hide admin login without plugin

There is an action hook called login_init. It’s also called on the registration page. You can simply attach wp_die() to it. You might want to disable the entire backend as well, which can be done by hooking into admin_init. add_action( ‘login_init’ , ‘wp_die’ ); add_action( ‘admin_init’ , ‘wp_die’ ); WordPress will exit with an empty … Read more

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