Get free premium widgets for your blog and website.
How to add meta tags in wordpress without plugin. Wordpress website guide. In this post I will explain you with simple example to update SEO meta tags to your wordpress website.
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEidKB_IjQtzfmZlIKUFCLIy1Dj9W2j7ALmsIyo0dcfqSrQKboM3vSV4YItkIVD1p7wF6LRGg-SV6ldlW7C55CQmO5U7D5T2JU3OhTOxxZIHB6UlGOIkJpyqOMms2tWGBJ1iJpGEAlwTWec/s1600/1.png)
You often come across to situations where you have limited resources and you wants to update meta tags to your WordPress website. Updating meta tags using plugin is easy but to make website more SEO friendly, I will suggest you to use my technique to update meta tags. It this technique, you need access of FTP only.
Step 1: Create a metatags.ini file with following format.
<---------------------------->[/]
title= "Your Title of Home Page Here"
desc= "Description of home page here"
[/page.php]
title= "Your Title of Page Here"
desc= "Description of page here"
and so on...........
<----------------------------->
Step 2: Create a metaparser.php with below code
<------------------------------><?php
class iniParser {
var $_iniFilename = '';
var $_iniParsedArray = array();
function iniParser( $filename )
{
$this->_iniFilename = $filename;
if($this->_iniParsedArray = parse_ini_file( $filename, true ) ) {
return true;
} else {
return false;
}
}
function getSection( $key )
{
return $this->_iniParsedArray[$key];
}
function getValue( $section, $key )
{
if(!isset($this->_iniParsedArray[$section])) return false;
return $this->_iniParsedArray[$section][$key];
}
function get( $section, $key=NULL )
{
if(is_null($key)) return $this->getSection($section);
return $this->getValue($section, $key);
}
function setSection( $section, $array )
{
if(!is_array($array)) return false;
return $this->_iniParsedArray[$section] = $array;
}
function setValue( $section, $key, $value )
{
if( $this->_iniParsedArray[$section][$key] = $value ) return true;
}
function set( $section, $key, $value=NULL )
{
if(is_array($key) && is_null($value)) return $this->setSection($section, $key);
return $this->setValue($section, $key, $value);
}
function save( $filename = null )
{
if( $filename == null ) $filename = $this->_iniFilename;
if( is_writeable( $filename ) ) {
$SFfdescriptor = fopen( $filename, "w" );
foreach($this->_iniParsedArray as $section => $array){
fwrite( $SFfdescriptor, "[" . $section . "]\n" );
foreach( $array as $key => $value ) {
fwrite( $SFfdescriptor, "$key = $value\n" );
}
fwrite( $SFfdescriptor, "\n" );
}
fclose( $SFfdescriptor );
return true;
} else {
return false;
}
}
}
?>
<------------------------------>
Step 3:Include metaparser in the header of your website.
<------------------------------><?php
include("metaparser.php");
$cfg = new iniParser("metatags.ini");
$title = $cfg->get($_SERVER['PHP_SELF'],"title");
$desc = $cfg->get($_SERVER['PHP_SELF'],"desc");
?>
<------------------------------>
These are the simple steps by applying you will be able to update meta tags to your WordPress website