Call Shortcode Attribute Value within another function

First: You return before you add the values to the $outvalue, so this part of the code is never reached. Second: You have typos, when adding the values to $outvalue. This function works for me: function myVal($attr, $content = null) { extract(shortcode_atts(array( ‘var1’ => ”, ‘var2’ => ”, ‘var3’ => ”, ‘var4’ => ”, ‘var5’ … Read more

Redirect after Permalink change – What regex do I use?

You can do this by regex rewriting the legacy URL as a query. You can do that either on the post_id or the postname, in this case I think the postname is probably safer (avoids false matches on some other path that might start with numbers). In custom functions, something like this: add_rewrite_rule( ‘^[0-9]+/(.*)/?’, ‘index.php?&name=$matches[1]’,’top’ … Read more

How to add rewrite rule for product compare page?

Here you go: compare\/([^-vs-]*)(?:-vs-)([^-vs-]*)(?:-vs-)?([^-vs-]*)? Remember to escape backslashes (as I have done). I also made your lookups more consistent in their internal logic/structure. I assumed you wouldn’t want a second -vs- if the third product wasn’t there, so this is why you now have the second non-capturing group. Here is a link with the answer … Read more

WordPress add_rewrite_rule with 2 variables

After lots of pulling my hair out I figured out the problem. I needed to use the add_rewrite_tag() function to tell wordpress to allow my query vars. function prefix_movie_rewrite_rule() { add_rewrite_tag(‘%state_id%’, ‘([A-Za-z0-9\-\_]+)’); add_rewrite_tag(‘%state%’, ‘([A-Za-z0-9\-\_]+)’); add_rewrite_rule ( ‘states/([A-Za-z0-9\-\_]+)/([A-Za-z0-9\-\_]+)’, ‘index.php? state_id=$matches[1]&state=$matches[2]’, ‘top’ ); } add_action( ‘init’, ‘prefix_movie_rewrite_rule’);

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)