Quantcast
Channel: Question and Answer » meta-query
Viewing all articles
Browse latest Browse all 36

meta tags doesnt fetch data from permalinks

$
0
0

i have a page http://studyofjoy.com/categories/
i want to add custom meta tags to heading section like this:

<meta property="og:title"              content="<?php echo "title:" . $get_title_raw; ?>" />
<meta property="og:image"              content="http://www.studyofjoy.com/wp-content/themes/studyofjoy/images/motivation/<?php echo $get_id; ?>.jpg" />
<meta property="og:image:width"        content="500" />
<meta property="og:image:height"       content="500" />

where

$get_title_raw = $wp_query->query_vars['get_title'];

functions.php file looks like:

function custom_rewrite_tag() {
add_rewrite_tag('%get_title%', '([^&]+)');
add_rewrite_tag('%get_id%', '([^&]+)');
}
add_action('init', 'custom_rewrite_tag', 10, 0);

function add_rewrite_rules($aRules) {
$aNewRules = array('categories/([^/]+)/([^/]+)/?$' => 'index.php?pagename=categories&get_title=$matches[1]&get_id=$matches[2]');
$aRules = $aNewRules + $aRules;
return $aRules;
}

// hook add_rewrite_rules function into rewrite_rules_array
add_filter('rewrite_rules_array', 'add_rewrite_rules');

the problem is when i upload website address to facebook scrapper, it doesnt load any information… about variables… i mean facebook scrapper $get_title_raw = $wp_query->query_vars['get_title'];
returns as empty space or null. how we can fix this??


Viewing all articles
Browse latest Browse all 36

Trending Articles