Der obs_open_graphdescription
Filter filtert die Ausgabe der Open Graph Description, og:description auf Produkt -und Kategorieseiten. Wenn das Yoast SEO Plugin verwendet wird, der og:description für Yoast SEO.
Dieser Filter läuft, wenn der Header einer Produkt -oder Kategorieseite erstellt wird.
Der Filter ist ab OBS Pages Version 1.8 verfügbar.
Beispiel-Anwendung über functions.php in Child-Theme
/**
* Filter the open graph description og:description before output
* Return empty string, if no og:description should be output
*
* @param string $description The meta description to be filtered and output as og:description.
* @param array $explore_path The explore_path array holding lots of info about the current page.
*/
function obs_adjust_og_description( string $description, array $explore_path ): string {
// TODO: get the og:description for the given path.
$og_description = obs_get_og_description( $explore_path );
if ( null !== $og_description ) {
$description = $og_description ;
}
return $description;
}
add_filter( 'obs_open_graph_description', 'obs_adjust_og_description', 10, 2 );
Anleitung zur Integration von Hooks
Eine Integration im Code
/**
* Filter the open graph description og:description before output
* Return empty string, if no og:description should be output
*
* @param string $description The meta description to be filtered and output as og:description.
* @param array $explore_path The explore_path array holding lots of info about the current page.
*/
$open_graph_description = apply_filters( 'obs_open_graph_description', $description, $this->explore_path );