vsandvold
Forum Replies Created
-
Forum: Plugins
In reply to: conditional rewrite rulesAny help is appreciated, guys.
Forum: Plugins
In reply to: conditional rewrite rulesWhat I get is this:
* concerts/ and venues/ don’t work
* concerts/year/month/day/postname shows all concerts, what I would like concerts/ to do
* Same for venues/Forum: Plugins
In reply to: conditional rewrite rulesSo far I tried the following, without getting what I want:
add_filter('rewrite_rules_array', 'my_rewrite'); function my_rewrite($rewrite) { global $wp_rewrite; $category_rules = array( 'concerts/' => 'category/concerts/', 'venues/' => 'category/venues/' ); $concert_post_structure = $wp_rewrite->root . "concerts/%year%/%monthnum%/%day%/%postname%/"; $venue_post_structure = $wp_rewrite->root . "venues/%postname%/"; return ( $rewrite + $category_rules + $wp_rewrite->generate_rewrite_rules($concert_post_structure) + $wp_rewrite->generate_rewrite_rules($venue_post_structure) ); }
Forum: Developing with WordPress
In reply to: register_activation_hook vs. add_actionThank you, Otto42!
Forum: Developing with WordPress
In reply to: register_activation_hook vs. add_actionThanks for the thorough explanation, Otto42!
So if I understand this right, add_action will hook a function to an action every time a page is loaded. The hooks then disappear when the page is done loading, because they aren’t persistent, and must be re-created for the next page load.
Seems to me this may add some runtime overhead for page requests, especially if my plugin grows and the site gets a lot of traffic. If I want to optimize my plugin, should I try to detect the context (view vs. admin), in order to execute only the code that is required? Or is WP already so optimized that this will have little effect?
Thanks again for spelling it out ??
BTW, what do you call the part of PHP script not contained within a function, class or a conditional block?