I am trying to get cutom post cout by month of current taxonmy term

you can do that with WordPress functions like that : $post_type = “tesekkur”; $timestamp_start = strtotime(“first day of next month -1 year midnight”); $start = date(“Y-m-d H:i:s”, $timestamp_start); $posts = get_posts([ “nopaging” => TRUE, “post_type” => $post_type, “date_query” => [ “after” => $start, ], ]); // sort by month $tab = []; foreach ($posts as … Read more

Custom Post Type “MUST NOT” be able to search via URL

Welcome! After creating a post type using pods, You can navigate to Advanced options and uncheck Public and Publicly Queryable. Note: There are parameters like exclude_from_search, publicly_queryable, show_ui, and show_in_nav_menus that are inheriting value from public. You need to set them manually if you want to use them. More info: https://developer.wordpress.org/reference/functions/register_post_type/

Using menu_position to add two entries between Dashboard and Posts

The order of the menu items can be changed using the filter menu_order add_filter( ‘menu_order’, ‘se354759_menu_order’ ); add_filter( ‘custom_menu_order’, ‘__return_true’ ); function se354759_menu_order ($menu_order) { $cpts = [ ‘edit.php?post_type=” . “custom-post-type’, ‘edit.php?post_type=” . “another-cpt’ ]; // // remove and save first item (“dashboard”) in variable $first_item = array_shift( $menu_order ); foreach( $cpts as $ctp ) … Read more

Query not work for current taxonomy

It looks like your query is for ALL posts in that post type as you are overwriting $posts when using $posts = get_posts(). You need to pass the Taxonomy parameter correctly as explained here like this: $args = array( ‘post_type’ => ‘post’, ‘tax_query’ => array( array( ‘taxonomy’ => ‘people’, ‘field’ => ‘slug’, ‘terms’ => ‘bob’, … Read more

I can no longer post or even save a draft, getting the error “A post type mismatch has been detected.”

In my version of WordPress this error will come from line 46 of wp-admin/post.php, which has: if ( isset( $_POST[‘post_type’] ) && $post && $post_type !== $_POST[‘post_type’] ) { wp_die( __( ‘A post type mismatch has been detected.’ ), __( ‘Sorry, you are not allowed to edit this item.’ ), 400 ); } The code … Read more

Return number of all custom posts type by author in all statuses

The code you shared worked fine for me, so either your value for $user_id or $post_type is incorrect – or the user actually has no posts of the post type you’re searching for. function get_user_posts_count($user_id, $post_type) { $args[‘author’] = $user_id; $args[‘fields’] = ‘ids’; $args[‘post_type’] = $post_type; $args[‘fields’] = ‘ids’; $args[‘blog_id’] = 4; $args[‘post_status’] = ‘any, … Read more