[wp-trac] [WordPress Trac] #30973: Add post type support for adjacent links

WordPress Trac noreply at wordpress.org
Sat Sep 12 19:45:11 UTC 2015


#30973: Add post type support for adjacent links
-------------------------------+-------------------------
 Reporter:  jfarthing84        |       Owner:
     Type:  enhancement        |      Status:  closed
 Priority:  normal             |   Milestone:
Component:  Posts, Post Types  |     Version:
 Severity:  normal             |  Resolution:  worksforme
 Keywords:  has-patch close    |     Focuses:
-------------------------------+-------------------------
Changes (by wonderboymusic):

 * status:  new => closed
 * resolution:   => worksforme
 * milestone:  Awaiting Review =>


Comment:

 {{{
 add_action( 'template_redirect', function () {
     $types = [ 'foo, 'bar' ];
     if ( ! is_single() || ! in_array( get_query_var( 'post_type'  ),
 $types ) ) {
          return;
     }

     remove_action( 'wp_head', 'adjacent_posts_rel_link_wp_head', 10, 0 );

     // OR

      //  this assumes you already called `add_post_type_support( 'foo',
 'adjacent-links' );`
     if ( post_type_supports( get_query_var( 'post_type'  ), 'adjacent-
 links' ) ) {
         remove_action( 'wp_head', 'adjacent_posts_rel_link_wp_head', 10, 0
 );
     }

 } );
 }}}

 UI elements (`<link>`s in this case) that appear on the front-end have
 nothing to do with `post_type` registration - BUT, you could easily add
 the value to `supports` and then check for that support here. So, what you
 are proposing already exists, it would be up to the theme to implement it
 anyways. We can't turn off global support for all post types and require
 people to add new code to turn them on. That could potentially break
 expected behavior for themes.

 Seems like you might just need this anyways:
 `<meta http-equiv="x-dns-prefetch-control" content="off" />`

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


More information about the wp-trac mailing list