get_posts wont produce a list of custom type from a given category [duplicate]

I’m assuming ‘news_category’ is a custom taxonomy; if not, and if you have simply created a new post category called ‘news_category’, it will only work if you add support to your custom post type. Be aware though that this will add complexities to your feeds and queries, as well as affecting how category posts show … Read more

Pagination Not Working When Used With WP_Query() `offset` Property

WP_Query docs gives a warning about the offset parameter: Setting the offset parameter overrides/ignores the paged parameter and breaks pagination. Try something like this: $paged = (get_query_var(‘paged’)) ? get_query_var(‘paged’) : 1; $newsArticles = new WP_Query(array( ‘posts_per_page’ => 16, ‘post_type’=> ‘news’, ‘paged’ => $paged, )); while( $newsArticles->have_posts()){ $newsArticles->the_post(); ?> // HTML <?php } ?> $big = … Read more

Custom post categories are not displaying on the page

$args = array( ‘post_type’ => ‘travelplan’, ‘numberposts’ => -1, ‘tax_query’ => array( array( ‘taxonomy’ => ‘travelplan_cat’, ‘field’ => ‘slug’, ‘terms’ => ‘testtravel’ ) ) ); $plans = get_posts( $args ); echo ‘<pre>’; print_r($plans); echo ‘</pre>’; Change your register_taxonomy like this function create_travelPlan_taxonomy() { register_taxonomy( ‘travelplan_cat’, ‘travelplan’, array( ‘label’ => __( ‘Category’ ), ‘rewrite’ => array( … Read more

How can i redirect click to new admin page not to edit screen in post table

On functions.php function disallowed_admin_pages() { global $pagenow; # Check current admin page. if ( $pagenow == ‘post.php’ && isset( $_GET[‘post’] ) && $_GET[‘action’] == ‘edit’ && (get_post_type( $_GET[‘post’]) ==’Post_type’ )) { wp_redirect( admin_url( ‘/edit.php?post_type=post_type&page=page_to_redirct&post=”.$_GET[“post’] ) ); exit; } } add_action( ‘admin_init’, ‘disallowed_admin_pages’ ); page_to_redirect is already created an included in functions.php