add endpoints on install

This commit is contained in:
Mike Jolley 2015-03-20 14:20:12 +00:00
parent 94335db2a6
commit 17ca08c020
3 changed files with 4 additions and 2 deletions

View File

@ -32,7 +32,7 @@ class WC_AJAX {
*/
public static function add_endpoint() {
add_rewrite_tag( '%wc-ajax%', '([^/]*)' );
add_rewrite_rule( 'wc-ajax/([^/]*)/?', 'index.php?wc-ajax=$matches[1]', 'top' );
add_rewrite_rule( 'wc-ajax/([^/]*)/?', 'index.php?wc-ajax=$matches[1]', 'top' );
}
/**

View File

@ -73,7 +73,7 @@ class WC_API {
* @since 2.0
* @return void
*/
public function add_endpoint() {
public static function add_endpoint() {
// REST API
add_rewrite_rule( '^wc-api/v([1-2]{1})/?$', 'index.php?wc-api-version=$matches[1]&wc-api-route=/', 'top' );

View File

@ -97,6 +97,8 @@ class WC_Install {
// Also register endpoints - this needs to be done prior to rewrite rule flush
WC()->query->init_query_vars();
WC()->query->add_endpoints();
WC_API::add_endpoint();
WC_AJAX::add_endpoint();
self::create_terms();
self::create_cron_jobs();