Perform a function when a user clicks register button

You can hook your function with user_register. It will fire immediately after an user registration is done. And user id is passed to hook as an argument. add_action( ‘user_register’, ‘my_custom_function’ ); function my_custom_function ( $user_id ) { //here goes your code }

Ascending order of yearly archives [closed]

You will have to define post order in second SQL query too. Try this one. // get years that have posts $years = $wpdb->get_results( “SELECT YEAR(post_date) AS year FROM wp_posts WHERE post_type=”post” AND post_status=”publish” GROUP BY year DESC” ); foreach ( $years as $year ) { // get posts for each year $posts_this_year = $wpdb->get_results( … Read more

Incorrect Use of wpdb::prepare()

You should try to replace the meta_value = $list->ID part with the placeholder meta_value = %d. Then use the following: $subscriber_count = $wpdb->get_var( $wpdb->prepare( $q, $list->ID ) ); where the input argument $list->ID will be treated as an integer (signed). From the Codex: The query parameter for prepare accepts sprintf()-like placeholders. The %s (string), %d … Read more

Save sql file after doing insert wpdb

Trivial! $wpdb->last_query will hold it. 🙂 For more extensive log you might want to define SAVEQUERIES constant to true in configuration. Full log then will be available in $wpdb->queries. It’s off by default for performance reasons.

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