Yoast SEO and JSON Rest API – permalinks not working
-
After installing Yoast SEO my permalinks didn’t work any longer. After testing a lot and removing all my other plugins I finally found out that this has to with some code in my functions.php, where I tried to remove/disable the JSON Rest API:
function remove_json_api () { // Remove the REST API lines from the HTML Header remove_action( 'wp_head', 'rest_output_link_wp_head', 10 ); remove_action( 'wp_head', 'wp_oembed_add_discovery_links', 10 ); // Remove the REST API endpoint. remove_action( 'rest_api_init', 'wp_oembed_register_route' ); // Turn off oEmbed auto discovery. add_filter( 'embed_oembed_discover', '__return_false' ); // Don't filter oEmbed results. remove_filter( 'oembed_dataparse', 'wp_filter_oembed_result', 10 ); // Remove oEmbed discovery links. remove_action( 'wp_head', 'wp_oembed_add_discovery_links' ); // Remove oEmbed-specific JavaScript from the front-end and back-end. remove_action( 'wp_head', 'wp_oembed_add_host_js' ); // Remove all embeds rewrite rules. add_filter( 'rewrite_rules_array', 'disable_embeds_rewrites' ); } add_action( 'after_setup_theme', 'remove_json_api' ); function disable_json_api () { // Filters for WP-API version 1.x add_filter('json_enabled', '__return_false'); add_filter('json_jsonp_enabled', '__return_false'); // Filters for WP-API version 2.x add_filter('rest_enabled', '__return_false'); add_filter('rest_jsonp_enabled', '__return_false'); } add_action( 'after_setup_theme', 'disable_json_api' );
Unfortunately Yoast SEO (and my whole website) doesn’t work when the oEmbed functionality ist removed from the WordPress installation and after that Yoast SEO ist installed. There is no error message on the screen, the permalinks are just not working.
But why? Why needs Yoast SEO this json stuff? And why are my permalinks not working after installing Yoast SEO?
Thank you for your help!
- The topic ‘Yoast SEO and JSON Rest API – permalinks not working’ is closed to new replies.