Tag Info

Hot answers tagged

2

I would use a custom query like this: $amsterdamstore_args = array( 'post_type' => 'store', // This is your custom post type 'tax_query' => array( array( 'taxonomy' => 'city', // This is your custom taxonomy 'terms' => 'Amsterdam', // The term you search for 'field' => 'name', // Check against the term's ...


2

You have the following methods of the $wpdb object: $wpdb->flush() that contains a call to mysqli_free_result() or mysql_free_result() if not supported. $wpdb->check_connection() that contains a call to mysqli_ping() or mysql_ping() if not supported. You can of course use all your PHP functions in WordPress. Here's an example based on the \wpdb ...


2

You can use the function get_post_types to get information on any and all post types that are active at that time. To get info on a specific post type, use get_post_type_object.


1

Yes, of course. Just provide new connection credentials. WordPress will use whatever database you tell it to. You can even use the same database with a different prefix. But it will probably be easier to regain access. See: https://codex.wordpress.org/Resetting_Your_Password


1

@Kiddy - If you are not able to go to the backend of your current site, then you may access your Database and change the username/password from there. Accessing database and changing username/password from there is not for newbie and needs to be done carefully. While this is not recommended but I would say this is one handy rescue measure. Please let me know ...


1

Yes, the 404 is because the local and remote server URLs are different. As a solution: You should set the local domain to be the same as the remote server In wp-config.php connect to the remote DB When you will need to access the remote server you'll need to update the file hosts and comment out the line with your remote url If your hosts file is updated ...


1

There is error in sql query. You have defined time as datetime and default value mentioned in current_timestamp. Define time as timestamp. Also specify length of email and page fields. Corrected query: $sql = "CREATE TABLE " . $table_name . " ( id INT NOT NULL AUTO_INCREMENT, time TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL, //Change datetime to ...


1

WordPress default comes with some sample post types like pages, posts etc. Wordpress has given option to create our own custom post types also. Both default & custom posts are stored in single table "wp_posts" by differentiating all posts types based on "post_type" column in "wp_posts" table. Eg: pages--> post_type="page", testiminials--> ...


1

Comment type is similar to post type, because it allow to query only a specific type of comments, just like post type allow to query one or more post types. And just like core post types (page, post) there are core comment type as well: 'comment', 'pingback', 'trackback'. A difference between the two is that, by default, WP_Query do not fetch post types ...


1

What the author of the article posted, as I read it, is suggesting you do is something like this: $cats = array(1,2,3,4); $q = new WP_Query( array( 'category__not_in' => $cats ) ); var_dump($q->request); You should see the complex default query in that dump. $ids = array_unique(get_objects_in_term($cats,'category')); var_dump($ids); Now ...


1

You need a custom query and loop here, at least that's how I do it. $args = array( 'post_type' =>'store', 'taxonomy' => 'city', 'term' => 'your list here' 'posts_per_page' => 5 ); $loop = new WP_Query($args); if($loop->have_posts()): while($loop->have_posts()): do stuff here endwhile; endif; You will probably want to ...



Only top voted, non community-wiki answers of a minimum length are eligible