Skip to content

Instantly share code, notes, and snippets.

@grola
Created February 26, 2018 13:15
Show Gist options
  • Save grola/3c0eb0d6b4c9f1ae33840659656800db to your computer and use it in GitHub Desktop.
Save grola/3c0eb0d6b4c9f1ae33840659656800db to your computer and use it in GitHub Desktop.
Add parameter to attachment url
add_filter( 'wp_get_attachment_url', 'grola_wp_get_attachment_url', 10, 2 );
function grola_wp_get_attachment_url( $url, $post_id ) {
return add_query_arg( 'p2', $post_id, add_query_arg( 'p', $post_id+1, $url ) );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment