InfoHeap
Tech
Navigation
  • Home
  • Tutorials
    • CSS tutorials & examples
    • CSS properties
    • Javascript cookbook
    • Linux/Unix Command Line
    • Mac
    • PHP
      • PHP functions online
      • PHP regex
    • WordPress
  • Online Tools
    • Text utilities
    • Online Lint Tools
search

Wordpress customization tutorials

  • Handle pagination in wordpress custom php code
  • How to and why disable wordpress cron
  • How to customize wordpress image alt tag
  • How to display date in wordpress pages
  • How to display wordpress page list with specific custom field value
  • How to display wordpress top level pages
  • How to hide a post from home and RSS feed in wordpress
  • How to include bootstrap javascript and css in wordpress post
  • How to include wordpress pages in archives
  • How to override priority and change frequency in Yoast xml sitemap
  • How to remove xmlrpc from wordpress headers
  • How to setup wordpress custom query params with pretty url format
  • How to show wordpress pages on front page with skip_home custom field
  • How to use google custom search for wordpress site
  • How to write custom php in wordpress
  • No frills social share links for Wordpress sites
  • Using Wordpress custom field for displaying code
  • Wordpress - add content filter after shortcode execution
  • Wordpress - customize category and tag links
  • Wordpress - customize facebook plugin opengraph meta tags
  • Wordpress - customize posts per page for tag, category and date archive pages
  • Wordpress - exclude specific posts from archive pages
  • Wordpress - get posts/pages with missing meta key
  • Wordpress - how to add filter to description meta tag
  • Wordpress - how to create custom tag cloud
  • Wordpress - how to exclude specific tag posts from a tag archive page
  • Wordpress - write custom php log to separate file
  • Wordpress how to check if a post is being viewed by admin
 
  • Home
  • > Tutorials
  • > Wordpress
  • > Wordpress customization

WordPress – customize facebook plugin opengraph meta tags

on Feb 29, 2016

If you are using facebook plugin in workdpress, it adds opengraph meta tags in wordpress posts. At times we want to remove or customize some of these meta tags. This tutorial will cover how can you customize these meta tags in wordpress.

These are some of the meta tags which get added in wordpress post in head section.

<meta property="og:site_name" content="InfoHeap" />
<meta property="og:type" content="article" />
<meta property="og:locale" content="en_US" />
<meta property="fb:app_id" content="[fb_id]" />
<meta property="og:url" content="[url]" />
<meta property="og:title" content="[title]" />
<meta property="og:description" content="[description]" />
<meta property="article:published_time" content="[published_time]" />
<meta property="article:modified_time" content="[modified_time]" />
<meta property="article:section" content="Tutorials" />
<meta property="article:tag" content="[tag1]" />
<meta property="article:tag" content="[tag2]" />

In case you need to customize these tags, you can use filter hook fb_meta_tags provided by facebook plugin. It passed $meta_tag array object to the filter. Here is how $meta_tag object looks like:
[http://ogp.me/ns#site_name] => InfoHeap
[http://ogp.me/ns#type] => article
[http://ogp.me/ns#locale] => en_US
[http://ogp.me/ns/fb#app_id] => APP_ID
[http://ogp.me/ns#url] => URL
[http://ogp.me/ns#title] => TITLE
[http://ogp.me/ns#description] => DESCRIPTION
[http://ogp.me/ns/article#published_time] => PUBLISHED_TIME
[http://ogp.me/ns/article#modified_time] => MODIFIED_TIME
[http://ogp.me/ns/article#author] => AUTHOR_URL
[http://ogp.me/ns/article#section] => CATEGORY
[http://ogp.me/ns/article#tag] => Array
    (
        [0] => tag1
        [1] => tag2
    )

Here is a sample wordpress php code to remove author meta tag from $meta_tag array object. You can use similar logic with do other customizations.
add_filter('fb_meta_tags', 'fb_meta_tags_customize');
function fb_meta_tags_customize($meta_tags) {
  $author_key = "http://ogp.me/ns/article#author";
  if (array_key_exists($author_key, $meta_tags)) {
    unset($meta_tags[$author_key]);
  }
  return $meta_tags;
}

Suggested posts:

  1. How to hide a post from home and RSS feed in wordpress
  2. How to use Google custom search with lazy loading approach
  3. Mac brew (homebrew) – quick start guide
  4. Command line – scale a video using ffmpeg
  5. How to ping feedburner to force update rss cache
  6. Mysql query to find all yoast meta description
  7. jQuery – difference between html() and text()
  8. Bulk convert jpeg files to png using sips on mac
Share this article: share on facebook share on linkedin tweet this submit to reddit
Posted in Tutorials | Tagged Tutorials, Wordpress, Wordpress customization
  • Browse content
  • Article Topics
  • Article archives
  • Contact Us
Popular Topics: Android Development | AngularJS | Apache | AWS and EC2 | Bash shell scripting | Chrome developer tools | Company results | CSS | CSS cookbook | CSS properties | CSS Pseudo Classes | CSS selectors | CSS3 | CSS3 flexbox | Devops | Git | HTML | HTML5 | Java | Javascript | Javascript cookbook | Javascript DOM | jQuery | Kubernetes | Linux | Linux/Unix Command Line | Mac | Mac Command Line | Mysql | Networking | Node.js | Online Tools | PHP | PHP cookbook | PHP Regex | Python | Python array | Python cookbook | SEO | Site Performance | SSH | Ubuntu Linux | Web Development | Webmaster | Wordpress | Wordpress customization | Wordpress How To | Wordpress Mysql Queries | InfoHeap Money

Copyright © 2025 InfoHeap.

Powered by WordPress