Use WP_Query for custom post type but result get empty

You can write like $args = array( ‘posts_per_page’ => 10, // -1 to fetch all posts ‘orderby’ => ‘date’, ‘order’ => ‘DESC’, ‘post_type’ => ‘at-subscription’, // the post type ‘post_status’ => ‘publish’, ‘suppress_filters’ => true ); $posts_array = get_posts( $args ); // For displaying all posts related to at-subscription print_r( $posts_array ); Hope this will … Read more

Creating Custom Hook for my plugin

First, register the filter hooks with the handy apply_filters tool: function wpse_238394_org_types() { return apply_filters( “my_org_types”, array( “affiliate”, “direct”, “bureau” ) ); } Now, wpse_238394_org_types() will return the default 3 types being not filtered yet, so we one more custom type: add_filter(“my_org_types”, function($types) { $types[] = “custom_type”; return $types; }); Now if you debug wpse_238394_org_types() … Read more