Quantcast
Channel: WordPress.org Forums » All Posts
Viewing all articles
Browse latest Browse all 112906

Aaron Nimocks on "want to create wordpress gallery link ending with hashtag"

$
0
0

I am not good at regular expressions and all that good stuff so I would need to fix it by trial and error.

But it would be something like below adding to functions.php

add_action('generate_rewrite_rules', 'attachment_rewrite_rule_14924');
function attachment_rewrite_rule_14924($wp_rewrite){
  $new_rules = array();
  $new_rules['attachment/(\d*)$'] = 'index.php?attachment_id=$matches[1]';
  $wp_rewrite->rules = $new_rules + $wp_rewrite->rules;
}

My first attempt would be changing it to

$new_rules['attachment/(\d*)$#image']

Like I said I suck at regular expressions so I can't help you anymore than this.


Viewing all articles
Browse latest Browse all 112906

Trending Articles