How to add logged in username after WordPress URL?

You can try this shortode in this plugin file or you can paste this method to bottom of active theme’s functions.php. If you are new to WordPress and need a help you can visit here for steps to add code in function. add_shortcode( ‘my-awesome-button’, ‘wp_my_awesome_bytton’ ); function wp_my_awesome_bytton( $atts ) { $button_html=””; if ( is_user_logged_in() … Read more

Rewrite rule regex help required

Our custom rewrite rule works for top-level services but not child services. Your rewrite rule, or the query (the second parameter for add_rewrite_rule()) is just missing a service query: add_rewrite_rule( // wrapped for brevity ‘^consultancy/(.*)/?’, // Here, add the &service=$matches[1] ‘index.php?post_type=service&name=$matches[1]&service=$matches[1]’, ‘top’ ); But, why don’t you just use consultancy as the rewrite slug when … Read more

Rewrite only if no other matching page is found

It turns out it was because the default category archive pages do not require the URL to start with /category. WordPress already matches the path /{category-slug} for the default category taxonomy archive. I fixed it by changing the default category archive rewrite to start with /category. function move_category_rule($rules) { if(array_key_exists(‘(.+?)/?$’, $rules)) { $val = $rules[‘(.+?)/?$’]; … Read more

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