WordPress URL Rewrite not working

first, you should use the proper filter and method to add query vars and rewrite rules and not manipulate the globals directly. the other issue I believe is your regex pattern, this is working for me: add_filter( ‘query_vars’, ‘wpa59404_query_vars’ ); function wpa59404_query_vars($query_vars){ $query_vars[] = ‘update_slug’; return $query_vars; } add_action( ‘init’, ‘wpa59404_rewrites’ ); function wpa59404_rewrites(){ add_rewrite_rule( … Read more

Show message on wordpress admin dashboard

When you redirect the user to the admin dashboard pass on a GET variable named “success_notice”, for example. So you get a URL like this: /wp-admin/index.php?success_notice=1. With that setup, just add the code that shows the success message on the dashboard only if that GET variable is set. add_action(‘admin_notices’, ‘wpse75629_admin_notice’); function wpse75629_admin_notice() { global $pagenow; … Read more

Writing a plugin that notify my friends of new post that mentions(@) them

Twice edited according to kaiser’s suggestions, unsecure version removed. <?php function my_email_friend($post_id = ”) { // get post object $post = get_post($post_id); // get post content $content = $post->post_content; // if @David exists if( 0 !== preg_match(‘/(@\w)/’, $content, $matches) ) $friend_display_name_like=”%” . like_escape($matches[0]) . ‘%’; else return; // do nothing if no matches global $wpdb; … Read more

Notify Admins about Plugin Merge

A very helpful question, I think. There are two plugins, for the discussions let’s say: ToBeDeprecated Plugin, and ToBeUplifted Plugin There could be many ways, but these are the points that come to my mind first: Before the Upgrade Seemless Migration In the code of the ToBeUplifted plugin, you should ensure a seamless migration process … Read more

Listen to Post action

This is more of a JavaScript the A WordPress Question but anyway, You can use the JavaScript onbeforeunload event something like: <script type=”text/javascript”> old = window.onbeforeunload; window.onbeforeunload = MyOnExit; function MyOnExit(){ //do your stuff here return old(); } </script>

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