Move the activitypub endpoint rule to the main rewrite addition function.
This is for two reasons: - No need to add the endpoint every time the plugin loads. - The old code didn't flush the rewrite rules, making the endpoint non-functional until something did (like the user saving the permalink settings)
This commit is contained in:
parent
5dac683c48
commit
47bd6eb3b4
2 changed files with 2 additions and 8 deletions
|
@ -116,6 +116,8 @@ function add_rewrite_rules() {
|
||||||
\add_rewrite_rule( '^.well-known/nodeinfo', 'index.php?rest_route=/activitypub/1.0/nodeinfo/discovery', 'top' );
|
\add_rewrite_rule( '^.well-known/nodeinfo', 'index.php?rest_route=/activitypub/1.0/nodeinfo/discovery', 'top' );
|
||||||
\add_rewrite_rule( '^.well-known/x-nodeinfo2', 'index.php?rest_route=/activitypub/1.0/nodeinfo2', 'top' );
|
\add_rewrite_rule( '^.well-known/x-nodeinfo2', 'index.php?rest_route=/activitypub/1.0/nodeinfo2', 'top' );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
\add_rewrite_endpoint( 'activitypub', EP_AUTHORS | EP_PERMALINK | EP_PAGES );
|
||||||
}
|
}
|
||||||
\add_action( 'init', '\Activitypub\add_rewrite_rules', 1 );
|
\add_action( 'init', '\Activitypub\add_rewrite_rules', 1 );
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,6 @@ class Activitypub {
|
||||||
public static function init() {
|
public static function init() {
|
||||||
\add_filter( 'template_include', array( '\Activitypub\Activitypub', 'render_json_template' ), 99 );
|
\add_filter( 'template_include', array( '\Activitypub\Activitypub', 'render_json_template' ), 99 );
|
||||||
\add_filter( 'query_vars', array( '\Activitypub\Activitypub', 'add_query_vars' ) );
|
\add_filter( 'query_vars', array( '\Activitypub\Activitypub', 'add_query_vars' ) );
|
||||||
\add_action( 'init', array( '\Activitypub\Activitypub', 'add_rewrite_endpoint' ) );
|
|
||||||
\add_filter( 'pre_get_avatar_data', array( '\Activitypub\Activitypub', 'pre_get_avatar_data' ), 11, 2 );
|
\add_filter( 'pre_get_avatar_data', array( '\Activitypub\Activitypub', 'pre_get_avatar_data' ), 11, 2 );
|
||||||
|
|
||||||
// Add support for ActivityPub to custom post types
|
// Add support for ActivityPub to custom post types
|
||||||
|
@ -96,13 +95,6 @@ class Activitypub {
|
||||||
return $vars;
|
return $vars;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Add our rewrite endpoint to permalinks and pages.
|
|
||||||
*/
|
|
||||||
public static function add_rewrite_endpoint() {
|
|
||||||
\add_rewrite_endpoint( 'activitypub', EP_AUTHORS | EP_PERMALINK | EP_PAGES );
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Schedule Activities.
|
* Schedule Activities.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in a new issue