• Updates

    Sunday, January 13, 2019

    How to Remove https://api.w.org/ Error - Wordpress


    When you are engaged in Web Development, specifically, using WordPress as your platform and CMS, you may have encountered this problem when validating thru W3C.

    Bad value https://api.w.org/ for attribute rel on element link: The string https://api.w.org/ is not a registered keyword.

    This can be difficult, and even annoying, as it may take time to navigate through all WordPress core files and remove this yourself. But there is an easier way to fix this error. .

    According to WordPress:

    "The WordPress REST API provides API endpoints for WordPress data types that allow developers to interact with sites remotely by sending and receiving JSON (JavaScript Object Notation) objects. JSON is an open standard data format that is lightweight and human-readable, and looks like Objects do in JavaScript; hence the name. When you send content to or make a request to the API, the response will be returned in JSON. This enables developers to create, read and update WordPress content from client-side JavaScript or from external applications, even those written in languages beyond PHP."


    To fix this, W3C requires the REST API attribute for "rel" to be removed. Just go to your functions.php file and paste the following codes at the very last lines:

    remove_action('template_redirect', 'rest_output_link_header', 11, 0);
    remove_action('wp_head', 'rest_output_link_wp_head', 10);
    remove_action('wp_head', 'wp_oembed_add_discovery_links', 10);

    This should fix your W3C validation error for Bad value https://api.w.org/ for attribute rel on element link: The string https://api.w.org/ is not a registered keyword.

    No comments:

    Post a Comment

    Contact Us

    Name

    Email *

    Message *

    Featured

    Total Pageviews