display posts of custom post type with custom taxonomy

I would use “get_the_terms” to get the terms related to the post instead of “get_terms”, here is a quick suggestion (not tested) $args=array( ‘post_type’=>’tour_package’, ‘post__not_in’ => array(get_the_ID()), ‘posts_per_page’=> 5, ‘caller_get_posts’=>1,//handle sticky post but not in first ); $categories = get_the_terms( get_the_ID(),’tour_category’ ); if ($categories) { $category_ids = array(); foreach($categories as $individual_category){ $category_ids[] = $individual_category->term_id; } … Read more

Sort by last word in title

I would use a wp_query. Place this in your functions.php: /** * Order posts by the last word in the post_title. * Activated when orderby is ‘wpse_last_word’ */ add_filter(‘posts_orderby’, function($orderby_sql, \WP_Query $q) { $orderbys = $q->get(‘orderby’); if (!$orderbys) { return; } if ($orderby_sql) { $orderby_sql_array = [$orderby_sql]; } else { $orderby_sql_array = []; } if … Read more

Flickering sidebar when scrolling page [closed]

You would need to know since when / which change it starts flickering. // you said since the content change. So try to change back step by step until you know which content component exactly causes this. Debug that change which caused that flickering. There are playing a lot of factors in here: Theme, Theme … Read more

tribe_get_start_time displays the current date and time on other post types than tribe_events

There are various ways to solve this. First coming to mind are checking via is_singular() or get_post_type(). Using the latter you could write foreach( $posts as $p ): setup_postdata( $p ); $post_type = get_post_type($p); if ($post_type === Tribe__Events__Main::POSTTYPE) { //or: if ($post_type === ‘tribe_events’) { // Display the date of the event $p_event = tribe_get_start_time … Read more

How to update all posts at once?

I think you want to mass change old URLs in website database after migration. You can do it either by using plugin or manually. Plugin Method: The Velvet Blues Update URLs plugin enables you to change the URLs at various places, like posts and pages excerpts. Follow these steps: Install and activate Velvet Blues Update … Read more

Where exactly should I hook in order to change the post’s ID before insertion in the database?

I did this and it gave me a post with the set import_id: $my_post = array( ‘import_id’ => 1234567890, ‘post_title’ => ‘Custom ID’, ‘post_content’ => ‘This post has a custom ID.’, ‘post_status’ => ‘publish’, ); wp_insert_post( $my_post ); In addition this will raise ID/index to the integer you set in the import_id so that subsequent … Read more