Advertisement
Guest User

Untitled

a guest
Jun 17th, 2019
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. $new_rules['images/(d*)$'] = 'index.php?attachment_id=$matches[1]';
  2.  
  3. function wpd_attachment_link( $link, $post_id ){
  4. $post = get_post( $post_id );
  5. return home_url( '/images/' . $post->post_title );
  6. }
  7. add_filter( 'attachment_link', 'wpd_attachment_link', 20, 2 );
  8.  
  9. function ro_remove_attachment_title_caption( $attach_id ){
  10. $args = array(
  11. 'ID' => $attach_id,
  12. 'post_name' => "permalinkName",
  13. );
  14. wp_update_post( $args );
  15. }
  16. add_action( 'add_attachment', 'ro_remove_attachment_title_caption', 10, 1 );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement