Access $_POST data after redirect

Redirects are GET requests usually, and the browser doesn’t send the POST data for those. That’s not something WordPress can change. You could create a session, or – better – process the POST data first, then redirect. In your plugin, you could do: add_action( ‘plugins_loaded’, ‘process_post_data’, 0 ); function process_post_data() { // Read raw POST … Read more

add_feed and flush_rewrite_rules

You have to check the existing rewrite rules before you run a flush. If your feed name is test, they are stored under the keys ‘feed/(feed|rdf|rss|rss2|atom|test)/?$’ and ‘(feed|rdf|rss|rss2|atom|test)/?$’. So this should do the trick: add_action( ‘init’, function() { $name=”test”; $registered = FALSE; add_feed( $name, ‘test_feed’ ); $rules = get_option( ‘rewrite_rules’ ); $feeds = array_keys( $rules, … Read more

Permalinks, Rewrites, Get Variables, Oh My!

I’m not sure but I think that you just need to add two query vars, “group” and “value”, not two rewrite tags. Can you try this: add_filter(‘query_vars’, ‘cyb_add_query_vars’); function cyb_add_query_vars( $vars) { $vars[] = “group”; // name of the var as seen in the query string and URL $vars[] = “value”; return $vars; } add_action(‘init’,’cyb_add_rewrite_rules’); … Read more

Pages should have priority when using add_rewrite_rule

If I understand you correctly, you could try to replace: add_rewrite_rule( ‘^prefix-(.*)’, ‘foo/bar/index.php?page=$matces[1]’, ‘top’ ); with add_rewrite_rule( ‘^prefix-(.*)’, ‘foo/bar/index.php?page=$matces[1]’, ‘bottom’ ); From the Codex: ‘top‘ will take precedence over WordPress’s existing rules, where ‘bottom‘ will check all other rules match first. Default: “bottom“

Child pages with same slug

In terms of being able to create that URL structure, it is definitely possible. If you are assigning those pages to a parent, it will allow you to have the same slug, as long as they all have different parents. I would definitely recommend that they don’t have the same content on each though, as … Read more

Custom rewrite rule for backend/admin?

In general, it is possible, but you need to define ADMIN_COOKIE_PATH in your wp-config.php to the value / which might cause security issues. First of all define this rewrite rules in your .htaccess right before the rewrite rule of wordpress: # Make sure, there is a trailing slash RewriteRule ^submit-project/add$ submit-project/add/ [R=301,L] # mask the … Read more

Custom URL for each product variation – rewrite rules

Ok, for anyone looking for this, here’s a complete plugin that I came up with, that solves the issue: <?php /* Plugin Name: WooCommerce Variations URL Description: Adds support for variation-specific URL’s for WooCommerce product variations Author: Václav Greif Version: 1.0 Author URI: https://wp-programator.cz */ namespace WCVariationsUrl; final class Init { /** * Call this … Read more

Does WP Have a Function To Generate .htaccess RewriteCond?

In short yes… ‘External’ Rewrite Rules If in add_rewrite_rule the rule is isn’t directed to index.php then the rule is treated as an ‘external’ rule (i.e. not to be processed by WordPress’ internal handing of rewrites) and instead written to the .htaccess file. I.e. if: add_rewrite_rule(‘^nutrition/([^/]*)/([^/]*)/?’,’somethingelse.php?p=12&food=$1 &variety=$2′,’top’); is used instead of add_rewrite_rule(‘^nutrition/([^/]*)/([^/]*)/?’,’index.php?p=12&food=$matches[1]&variety=$matches[2]’,’top’); Then the rule … Read more

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