Guest User

Untitled

a guest
Jan 21st, 2019
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. // Remove media/attachment permalink
  2. if ( !function_exists( 'ff_cleanup_attachment_permalink' ) ) {
  3. function ff_cleanup_attachment_permalink( $rules ) {
  4. foreach ( $rules as $regex => $query ) {
  5. if ( strpos( $regex, 'attachment' ) || strpos( $query, 'attachment' ) ) {
  6. unset( $rules[ $regex ] );
  7. }
  8. }
  9. return $rules;
  10. }
  11. add_filter( 'rewrite_rules_array', 'ff_cleanup_attachment_permalink' );
  12. }
  13.  
  14. if ( !function_exists( 'ff_cleanup_attachment_link' ) ) {
  15. function ff_cleanup_attachment_link( $link ) {
  16. return;
  17. }
  18. add_filter( 'attachment_link', 'ff_cleanup_attachment_link' );
  19. }
Add Comment
Please, Sign In to add comment