Custom post type not showing in xml sitemap

I create a custom post type in WordPress and it’s working. My issue is when I create my XML sitemap then I am getting my all the pages and post but not getting the custom post type.

Would you help me out with this?

// Register Custom Post Type blog function create_blog_cpt() {      $  labels = array(         'name' => _x( 'blogs', 'Post Type General Name', 'bloglist' ),         'singular_name' => _x( 'blog', 'Post Type Singular Name', 'bloglist' ),         'menu_name' => _x( 'blogs', 'Admin Menu text', 'bloglist' ),         'name_admin_bar' => _x( 'blog', 'Add New on Toolbar', 'bloglist' ),         'archives' => __( 'blog Archives', 'bloglist' ),         'attributes' => __( 'blog Attributes', 'bloglist' ),         'parent_item_colon' => __( 'Parent blog:', 'bloglist' ),         'all_items' => __( 'All blogs', 'bloglist' ),         'add_new_item' => __( 'Add New blog', 'bloglist' ),         'add_new' => __( 'Add New', 'bloglist' ),         'new_item' => __( 'New blog', 'bloglist' ),         'edit_item' => __( 'Edit blog', 'bloglist' ),         'update_item' => __( 'Update blog', 'bloglist' ),         'view_item' => __( 'View blog', 'bloglist' ),         'view_items' => __( 'View blogs', 'bloglist' ),         'search_items' => __( 'Search blog', 'bloglist' ),         'not_found' => __( 'Not found', 'bloglist' ),         'not_found_in_trash' => __( 'Not found in Trash', 'bloglist' ),         'featured_image' => __( 'Featured Image', 'bloglist' ),         'set_featured_image' => __( 'Set featured image', 'bloglist' ),         'remove_featured_image' => __( 'Remove featured image', 'bloglist' ),         'use_featured_image' => __( 'Use as featured image', 'bloglist' ),         'insert_into_item' => __( 'Insert into blog', 'bloglist' ),         'uploaded_to_this_item' => __( 'Uploaded to this blog', 'bloglist' ),         'items_list' => __( 'blogs list', 'bloglist' ),         'items_list_navigation' => __( 'blogs list navigation', 'bloglist' ),         'filter_items_list' => __( 'Filter blogs list', 'bloglist' ),     );     $  args = array(         'label' => __( 'blog', 'bloglist' ),         'description' => __( '', 'bloglist' ),         'labels' => $  labels,         'menu_icon' => 'dashicons-admin-comments',         'supports' => array('title', 'editor', 'thumbnail', 'custom-fields'),         'taxonomies' => array(),         'public' => true,         'show_ui' => true,         'show_in_menu' => true,         'menu_position' => 5,         'show_in_admin_bar' => true,         'show_in_nav_menus' => true,         'can_export' => true,         'has_archive' => true,         'hierarchical' => false,         'exclude_from_search' => true,         'show_in_rest' => true,         'publicly_queryable' => true,         'capability_type' => 'post',     );     register_post_type( 'blog', $  args );  } add_action( 'init', 'create_blog_cpt', 0 ); 

Post slug cannot be edited after add add_rewrite_rule

Because I wanted to add a blog reference to the slug of each post, I add a add_rewrite_rule. But now the slug can not be edited on the dashboard. How can I make the slug editable? my dashbord: enter image description here

my code:

 // Add /blog/ to all blog pages. class BlogPage{      const SLUG_BLOG = 'blog';      public static function init() {         self::wpa_fix_blog_pagination();     }      public static function wpa_fix_blog_pagination(){          // Fix pagination         add_rewrite_rule(             'blog/page/([0-9]+)/?$  ',             'index.php?pagename=blog&paged=$  matches[1]',             'top'         );           // Change the default 'post' and add /blog/ to permalink.         add_rewrite_rule(             self::SLUG_BLOG.'/([^/]*)$  ',             'index.php?name=$  matches[1]',             'top'         );         add_rewrite_tag('%'.self::SLUG_BLOG.'%','([^/]*)');            // Change the default permalink structure of tags and categories         global $  wp_rewrite;         $  wp_rewrite->extra_permastructs['category']['struct'] = '/' . self::SLUG_BLOG .'/category/%category%';         $  wp_rewrite->extra_permastructs['post_tag']['struct'] = '/' . self::SLUG_BLOG .'/tag/%post_tag%';          // Change the default permalink structure of authors         $  wp_rewrite->author_base = 'blog/author';         $  wp_rewrite->author_structure = '/' . $  wp_rewrite->author_base . '/%author%';         add_rewrite_rule(self::SLUG_BLOG .'/author/([^/]+)/?$  ', 'index.php?author_name=$  matches[1]', 'top');           add_filter( 'post_link', array(__CLASS__,'change_post_link'), 10, 3 );     }       public static function change_post_link($  url, $  post, $  leavename){         if ( $  post->post_type == 'post' ) {             $  url = home_url( user_trailingslashit( self::SLUG_BLOG . '/' . $  post->post_name ) );         }         return $  url;     }  } // Init Blog Class add_action("init",function(){     BlogPage::init(); });   function fix_guid( $  guid ) {     $  guid = get_permalink( get_the_ID() );     return $  guid; } add_filter( 'get_the_guid', 'fix_guid' );  // redirect_posts_to_newblogurl if the post not starts with /blog/ add_action('template_redirect', function() {     $  lang = $  _COOKIE["wp-wpml_current_language"];      if (is_singular('post') && $  lang == 'en') {         if (substr( $  _SERVER['REQUEST_URI'], 0, 6 ) !== "/blog/") {             wp_redirect( get_the_permalink(), 301 );             exit;         }      } }); 

Custom Post Type Archive Page URL

I created a custom post type called provider, and currently I have a URL structure like so:

  1. .com/provider/abc
  2. .com/provider/xyz
  3. etc…

Now I would like to add some content in the provider page, mostly for SEO reasons. After having a look at how archive pages are working, I found out that it would be best to just change the URL of the archive page for provider. So the new URL would be .com/provider-archive/ while keeping the same URL for the provider already in the system, so they would remain:

  1. .com/provider/abc
  2. .com/provider/xyz
  3. etc…

This way, I would be able to create a regular page and give it the /provider/ URL.

I am trying to do so by changing the rewrite, adding in a slug to be provider-archive. After doing all of this, and creating a new page with the URL /provider/, when I try to access said URL I still see the archive.

This is how my custom post type is set up:

/**  * Register Provider Meta Box  */  add_action('init', 'cpt_provider'); function cpt_provider() {      $  labels = array(         'name'               => _x('Providers', 'post type general name', 'mebo-cpt'),         'singular_name'      => _x('Provider', 'post type singular name', 'mebo-cpt'),         'menu_name'          => _x('Providers', 'admin menu', 'mebo-cpt'),         'name_admin_bar'     => _x('Provider', 'add new on admin bar', 'mebo-cpt'),         'add_new'            => _x('Add New', 'book', 'mebo-cpt'),         'add_new_item'       => __('Add New Provider', 'mebo-cpt'),         'new_item'           => __('New Provider', 'mebo-cpt'),         'edit_item'          => __('Edit Provider', 'mebo-cpt'),         'view_item'          => __('View Provider', 'mebo-cpt'),         'all_items'          => __('All Providers', 'mebo-cpt'),         'search_items'       => __('Search Providers', 'mebo-cpt'),         'parent_item_colon'  => __('Parent Providers:', 'mebo-cpt'),         'not_found'          => __('No Providers found.', 'mebo-cpt'),         'not_found_in_trash' => __('No Providers found in Trash.', 'mebo-cpt')     );      $  args = array(         'labels'             => $  labels,         'description'        => __('Description.', 'mebo-cpt'),         'public'             => true,         'publicly_queryable' => true,         'show_ui'            => true,         'show_in_menu'       => true,         'query_var'          => true,         'capability_type'    => 'post',         'rewrite'           => array( 'slug' => 'provider-archive' ),         'hierarchical'       => true,         'menu_position'      => null,         'menu_icon'          => get_template_directory_uri() . '/img/icons/Gun-512.png',         'supports'           => array('title', 'editor')     );      register_post_type('provider', $  args); } 

Is there anything that I’m missing?

Sort custom post type by custom taxonomy

Im using this code to sort my custom post type by one of its custom taxonomies:

   <?php         $  valores = get_terms('valor', array('order' => 'DESC',));         foreach($  valores as $  valor) {             $  posts = get_posts(array(                     'post_type' => 'propriedade',                     'tax_query' => array(                         array(                             'taxonomy' => 'valor',                             'field' => 'slug',                             'terms' => $  valor->slug                             )                         ),                     'numberposts' => -1                 ));             foreach($  valores as $  valor) {                 print_r($  valor);             }         }     ?> 

but the list seems not to be ordered as DESC:

WP_Term Object (     [term_id] => 28     [name] => 40000     [slug] => 40000     [term_group] => 0     [term_taxonomy_id] => 28     [taxonomy] => valor     [description] =>      [parent] => 0     [count] => 1     [filter] => raw ) WP_Term Object (     [term_id] => 32     [name] => 2000000     [slug] => 2000000     [term_group] => 0     [term_taxonomy_id] => 32     [taxonomy] => valor     [description] =>      [parent] => 0     [count] => 1     [filter] => raw ) WP_Term Object (     [term_id] => 27     [name] => 2000     [slug] => 2000     [term_group] => 0     [term_taxonomy_id] => 27     [taxonomy] => valor     [description] =>      [parent] => 0     [count] => 1     [filter] => raw ) 

What I need is to make name or slug start from the lowest value to the higher value.

How to make goalKeeper move within post but not move towards to the player?

Hello so basically I make a 2d top-down soccer game but I have to trouble with GK AI, I want to GK is followed the ball but not move toward on it

let say (Enemy = GK) enter image description here

enter image description here

so when the player moves to the left or right the enemy will follow to the right or left not The Yaxis but in X-axis with guarding the post or Y=0

my default enemy movement is like this :

if (gameObject.CompareTag("GK"))         {              anim.SetBool("GKRun", false);             gkballInRange = Physics2D.OverlapCircle(transform.position, gkballRange, playerMask);             float distancePlayer = Vector2.Distance(target.position, transform.position);              if (gkballInRange)             {                 if (distancePlayer <= gkballRange)                 {                     //Animation                     anim.SetBool("GKRun", true);                     transform.Translate(0, -speed * Time.deltaTime, 0);                 }             }          } 

in that scrip, when the ball is on the range the GK is moving to the ball just that. maybe anyone can explain to me how to do it?

How to create a custom template for a custom post types category

I’m working on a custom post type and need to assign a new template to one of the custom post types categories.

So far i’ve tried adding a new categories.php file with the category name at the end, which is ‘automotive’. However, It didn’t seem to overwrite the default template which is set for the custom post type.

Can someone please advise me on how I can assign a new template to a custom post type category.

Assign multiple taxonomies to one post

I have created CPT called "Pharmacy" which have a lot of pharmacies inside (approx 10.000)

Pharmacies offer 2 different services (skin & scalp) and some provide both services but some provide only one.

What I am trying to add is skin & scalp as taxonomies that can be assigned to each pharmacy depending what they offer.

So let’s say that pharmacy_one offers both services then the link structure should look like this:

/skin/pharmacy_one /scalp/pharmacy_one 

Finally, these taxonomies (skin & scalp) need to be connected to custom template page-skin.php & page-scalp.php depending on the URL and display different layout.

So "pharmacy_one" needs to have 2 layout and 2 links.

Is it possible to achieve it?

facetwp leave all filters active across all pages, archives or single post

I will be quick and precise, I created a real estate site, I used the facetwp solution not very difficult to understand and with a rich documentation and hooks. I think I have everything in front of me but I need some help to understand which one. I’m still learning.

I put the links at the bottom.

the problem I can’t figure out which hook to use to basically tell facetwp to leave all filters active across all pages, archives or single post of properties , ignore post category, taxonomies, etc..do not auto-detect filters ,the header filters must remain the same everywhere

I have attached an illustration

facetwp_is_main_query

How to Customize WordPress Archive Queries

80 hooks available wich one i can use ?

they talk about that too :" Instead of creating an entirely separate query, we recommend using WP’s pre_get_posts filter to modify the existing query."

update 26/10/2020

I updated the image to illustrate the problem.

I still haven’t figured out what to do.. I hope it’s clear and at least someone understands the problem.

enter image description here