Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Remove media/attachment permalink
- if ( !function_exists( 'ff_cleanup_attachment_permalink' ) ) {
- function ff_cleanup_attachment_permalink( $rules ) {
- foreach ( $rules as $regex => $query ) {
- if ( strpos( $regex, 'attachment' ) || strpos( $query, 'attachment' ) ) {
- unset( $rules[ $regex ] );
- }
- }
- return $rules;
- }
- add_filter( 'rewrite_rules_array', 'ff_cleanup_attachment_permalink' );
- }
- if ( !function_exists( 'ff_cleanup_attachment_link' ) ) {
- function ff_cleanup_attachment_link( $link ) {
- return;
- }
- add_filter( 'attachment_link', 'ff_cleanup_attachment_link' );
- }
Add Comment
Please, Sign In to add comment