Add manifest.json To WordPress

@functions.php

//Manifest file
add_action( 'wp_head', 'inc_manifest_link' );
//Creates the link tag
function inc_manifest_link() {   
echo '<link rel="manifest" href="'.get_template_directory_uri().'/manifest.json">';
echo '<meta name="theme-color" content="#ffffff"/>';
}

Created a link to a manifest.json file example:

    {
    "short_name": "YourName",
    "name": "YourName",
    "icons": [
    {
      "src": "YourName.png",
      "type": "image/png",
      "sizes": "192x192",
      "purpose": "maskable"
    },
    {
      "src": "YourName.png",
      "type": "image/png",
      "sizes": "512x512"
    }
    ],	
    "start_url": "index.php",
    "background_color": "#ffffff",
    "display": "standalone",
    "scope": "/",
    "theme_color": "#ad0101",
    "description": "YourDescription"
    }
Scroll to Top