New answers tagged

1

I'm guessing it's because you used order_by when it should actually be orderby - that order_by wasn't just a typo in the question, right? And also, if the meta value is a date, then you should also set the meta_type parameter to DATE so that the sorting works as expected. So try with: $the_query = new WP_Query( array( 'post_type' => 'event', '...


0

Try with wp search-replace. Searches through all rows in a selection of tables and replaces appearances of the first string with the second string. WP-CLI is the command-line interface for WordPress. You can update plugins, configure multisite installations and much more, without using a web browser.


0

The problem is that you're using term IDs in your URL, but that is incorrect. Use the term slug instead. For example, lets say we have a mytax term named helloworld with the term ID 1: example.com/cpt/?mytax=1 404 example.com/cpt/?mytax=helloworld a cpt archive filtered by the helloworld term


0

global $wpdb; $table_name = $wpdb->prefix . 'your_table_name'; $results = $wpdb->get_results( "SELECT * FROM $table_name" ); foreach($results as $row) { echo $row->id; }


1

It doesn't work with add_rewrite_rule() because of the ?view= part in the URL (it's the first parameter for the function) — i.e. WordPress strips that query string part, hence it's not included when WordPress finds a matching rewrite rule. how I can remove ?view=12a34b56 after set post name You can't (not on the same page), because that is a query string ...


0

Resolved using this: <div> <ul> <?php $current_category = get_queried_object(); ////getting current category $args = array( 'post_type' => 'page',// your post type, 'orderby' => 'menu_order', 'order' => 'DESC', 'cat' => $current_category->cat_ID // ...


0

Assuming you mean $post->ID, you can use the post_link and post_type_link filters to append your query string. We're using the add_query_arg() function to do this: /** * Modify the posts navigation WHERE clause * to include our acceptable post types * * @param String $post_link - Post URL * @param WP_Post $post - Current Post * * @return String *...


0

I know the question is answered, but if anyone is trying to achieve the same with a raw SQL query, you could try the following: SELECT * FROM wpiw_posts WHERE ID IN ( SELECT object_id FROM wpiw_term_relationships AS TR INNER JOIN wpiw_term_taxonomy AS TT ON TR.term_taxonomy_id = TT.term_taxonomy_id INNER JOIN wpiw_terms AS T ON TT....


1

Your message_id is a BIGINT whereas the id of wp_ccwwhsh_sent_messages is INT. Replace BIGINT by INT and try again. The error message, unfortunately, isn't very helpful.


0

You could adapt get_post_acestors(), and write a similar function for comments. Here is an example that returns the top comment's id or false. Not tested! function get_root_comment( $comment_id ) { $comment = get_comment( $comment_id ); if ( ! $comment || empty( $comment->comment_parent ) || $comment->comment_parent ==...


Top 50 recent answers are included