Last active
June 12, 2018 19:04
-
-
Save aaronpeterson/9637291 to your computer and use it in GitHub Desktop.
get_adjacent_post buster for a wordpress custom post type.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<php | |
// in your constructor, etc | |
add_filter('get_previous_post_where', array($this, 'removePreviousPost')); | |
// have not tested this one but maybe? | |
add_filter('get_next_post_where', array($this, 'removePreviousPost')); | |
// kill with impossible sql | |
// @see https://core.trac.wordpress.org/browser/tags/3.5.1/wp-includes/link-template.php#L1173 | |
public function removePreviousPost($where) { | |
global $post_type; | |
if( $post_type != self::$postType ) | |
return $where; | |
return 'WHERE 1=2'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Already solved! I just put this into my theme's function.php:
// Removes the relational links for the posts adjacent to the current post
remove_action( 'wp_head', 'adjacent_posts_rel_link' );
remove_action( 'wp_head', 'adjacent_posts_rel_link_wp_head' );
Got it from here:
https://wordpress.stackexchange.com/questions/207104/edit-theme-wp-head