[wp-trac] [WordPress Trac] #42367: Create API for TITLES and other OPEN GRAPH data (was: ---)

WordPress Trac noreply at wordpress.org
Sat Oct 28 19:55:37 UTC 2017


#42367: Create API for TITLES and other OPEN GRAPH data
-----------------------------+------------------------
 Reporter:  tazotodua        |       Owner:
     Type:  feature request  |      Status:  closed
 Priority:  normal           |   Milestone:
Component:  General          |     Version:
 Severity:  normal           |  Resolution:  duplicate
 Keywords:                   |     Focuses:
-----------------------------+------------------------
Description changed by SergeyBiryukov:

Old description:

> every SEO or Optimization or META-related plugins see/inject their own
> meta tags in head of theme, as in many cases, there are multiple repeated
> tags in output:
>

> {{{
> <head>
> .......
> <meta name="og:title"        content="title by plugin1"
> .......
> some codes here
> .......
> <meta name="og:title"        content="title by plugin2"
>
> </head>
> }}}
>
> One plugin, which tries to overwrite other meta tags, has to use the
> undesired approach:
>
> get_ob_contents() --->then preg-replace the matched meta tags and etc...
>

> you know 90% of WP sites HAS TO USE META TAGS, ESPECIALLY FOR FACEBOOK,
> TWITTER, G+ share tags and some other.
> Cant WordPress create a new API to standartize the process, for example,
> in the Core, there was:
>
> add_action('wp_head', 'add_meta_tags_in_head');
> function add_meta_tags_in_head(){
>     //let people have ability to disable auto-generation of tags
>     if(defined("DISABLE_ADDING_OG_META_TAGS_AUTOMATICALLY"){
>         $title = get_the_title();  //or whatever
>         echo '<meta name="og:title" content="'. apply_filters("og_title",
> $title).'" />';
>         $description= get_the_title();  //or whatever
>         echo '<meta name="og:description" content="'.
> apply_filters("og_description", $description).'" />';
>
>         .... and same for Twitter, G+ and some other ESSENTIAL, EVERY-DAY
> tags, to be available for filtering
>
>     }
> }

New description:

 every SEO or Optimization or META-related plugins see/inject their own
 meta tags in head of theme, as in many cases, there are multiple repeated
 tags in output:


 {{{
 <head>
 .......
 <meta name="og:title"        content="title by plugin1"
 .......
 some codes here
 .......
 <meta name="og:title"        content="title by plugin2"

 </head>
 }}}

 One plugin, which tries to overwrite other meta tags, has to use the
 undesired approach:

 get_ob_contents() --->then preg-replace the matched meta tags and etc...


 you know 90% of WP sites HAS TO USE META TAGS, ESPECIALLY FOR FACEBOOK,
 TWITTER, G+ share tags and some other.
 Cant WordPress create a new API to standartize the process, for example,
 in the Core, there was:
 {{{
 add_action('wp_head', 'add_meta_tags_in_head');
 function add_meta_tags_in_head(){
     //let people have ability to disable auto-generation of tags
     if(defined("DISABLE_ADDING_OG_META_TAGS_AUTOMATICALLY"){
         $title = get_the_title();  //or whatever
         echo '<meta name="og:title" content="'. apply_filters("og_title",
 $title).'" />';
         $description= get_the_title();  //or whatever
         echo '<meta name="og:description" content="'.
 apply_filters("og_description", $description).'" />';

         .... and same for Twitter, G+ and some other ESSENTIAL, EVERY-DAY
 tags, to be available for filtering

     }
 }
 }}}

--

--
Ticket URL: <https://core.trac.wordpress.org/ticket/42367#comment:4>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list