Top tags with minimum number of posts

I found a solution!: $term_ids = $wpdb->get_col(” SELECT term_id FROM $wpdb->term_taxonomy INNER JOIN $wpdb->term_relationships ON $wpdb->term_taxonomy.term_taxonomy_id=$wpdb->term_relationships.term_taxonomy_id INNER JOIN $wpdb->posts ON $wpdb->posts.ID = $wpdb->term_relationships.object_id WHERE DATE_SUB(CURDATE(), INTERVAL 1 DAY) <= $wpdb->posts.post_date” ); $tags = get_tags(array( ‘orderby’ => ‘count’, ‘order’ => ‘DESC’, ‘number’ => ’10’, // <– maximum number of tags ‘include’ => $term_ids, ‘fields’ => ‘ids’ … Read more

How do I create a WP endpoint that retrieves all custom post types that have a tag?

You’ll need to expose both the Custom Post Type (CPT) and the taxonomy you are attaching to that CPT that you’d like access to. This is a great article that helped me the first time I used it. https://developer.wordpress.org/rest-api/extending-the-rest-api/adding-rest-api-support-for-custom-content-types/ If you are trying to expose the CPT and the Taxonomy to search, it’s something similar … Read more

Displaying SQL query result from user input via wpdb

use this snippet it works <?php if(isset($_POST[“ICNo”])) { global $wpdb; $name = $_POST[“ICNo”]; $resultsap = $wpdb->get_results( $wpdb->prepare( “SELECT * FROM wp_apelc_users WHERE icno = %s”, $name ) ); foreach ($resultsap as $row) { echo ‘Name: ‘ . $row->name; } } ?> <form method=”post”> <div> Your IC No: <input type=”text” name=”ICNo”> <input type=”submit” name=”submit” value=”Submit” > … Read more

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