This article introduces SEO measures for adding strings enclosed in 「」 or 【】 as meta keywords using PHP in the WordPress API.
This is also implemented on our site. Please use it as a reference.
if ( preg_match_all('/(【(.{2,12}?)】|「(.{2,12}?)」)/i' , $post->post_title , $matches, PREG_OFFSET_CAPTURE) ) {
echo 'y' ;
echo var_dump( $matches ) ;
$array = array_values(array_slice($matches, 2,3) ) ;
for ($i = 0; $i < 2; $i++) {
for ($j = 0; $j < count($array[$i]); $j++) {
if ( $array[$i][$j][0] !== '' ){
echo $array[$i][$j][0] . "\n" ;
$keywords = $array[$i][$j][0] . "," . $keywords ;
}
}
}
}