Fastest way to display 5000 post titles?

In my opinion and from what i’ve seen on testing. Using any WordPress function will slow things down dramatically. The fastest way i found to do this is by querying MySQL directly and grabbing only the things needed. For example: $products = $wpdb->get_results( “SELECT post_title, post_name FROM `wp_posts` WHERE post_type=”products””, ARRAY_A ); echo ‘<ol>’; foreach … Read more

Nested select statements not working

You need to identify the tables for each of the columns that have the same name. You should also be using an IN statement and not = for the department. I can’t test this since I don’t have your DB but you can try this: $sql = $wpdb->get_results(“SELECT * FROM ” . $wpdb->prefix . “dir_personnel … Read more

update_option returns false in AJAX, how to debug?

I found out that my settings where filtered by validation function registered by register_setting. Somehow I thought that it would only affect settings that where going through wordpress’s own settings fields and not a custom AJAX function (the way I have it setup). To the point of the question: I used php exit to debug … Read more

Help posting values to DB on submit using $wpdb->query

$wpdb has an insert method, so you can try the following: $table=”wp_email_subscribers”; $data = array( ‘first_name’ => $firstname, ‘last_name’ => $lastname, ’email’=> $email , ‘gdpr_consent’=>$gdprconsent ); $format = array(‘%s’,’%s’, ‘%s’, ‘%s’); $wpdb->insert($table,$data,$format); var_dump($wpdb->insert_id);

How to show result of sql query in a page?

Solved! I follow this tutorial: https://wordpress.org/gutenberg/handbook/designers-developers/developers/tutorials/block-tutorial/writing-your-first-block-type/ https://wordpress.org/gutenberg/handbook/designers-developers/developers/tutorials/block-tutorial/creating-dynamic-blocks/ And complimented with this: https://gist.github.com/mattheu/7cf235b4f932de891bc21cb5f3ff3de6

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