Generating a Rewrite Rule for sSecific Post-Requests from a Submitted Form?

I imagine that wouldn’t be too difficult. Assuming the number of custom ‘dynamic’ urls is known, this should do the trick:

foreach ( array( 'most-recent','last-week','category-1/most-recent','category-1/last-week') as $page )
  add_rewrite_rule( "$page/?$", 'index.php', 'top' );

What this does is tells WordPress “Whenever you have a url structure that matches X, treat it as if the url were just site.com/index.php, and check against this rule before anything else.” WordPress will treat it as if it’s the home page, but will also send the $_POST information from the form and get the correct information.

That first argument is a regular expression, so it might not be a bad idea to run each item through preg_quote() beforehand.

Hope that helped!

EDIT

I would strongly advise against using any sort of wildcard regular expression for this operation. Otherwise pages will start matching against this rule.

For our purposes think of these structures as having positions, separated by /. For example, in category-1/most-recent, position 1 would be category-1 and position 2 would be most-recent. So, for all structures make an array for each position with all the strings that might go into that position. So you might have something like this:

$timing = array(
  'most-recent',
  'last-week',
);
$cats = array(
  'category-1',
  'category-2',
  'category-3'
);
$timing = array_map( 'preg_quote', $timing );
$timing = implode( '|', $timing );
$cats = array_map( 'preg_quote', $cats );
$cats = implode( '|', $cats );
add_rewrite_rule( "($timing)/?$", 'index.php', 'top' );
add_rewrite_rule( "($cats)/($timing)/?$", 'index.php', 'top' );

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