Custom URL for Custom Post Type & Custom Taxonomy Term
Maybe this plugin could help you ? https://wordpress.org/plugins/remove-taxonomy-base-slug/
Maybe this plugin could help you ? https://wordpress.org/plugins/remove-taxonomy-base-slug/
the hooks “save_post…” are called too when a new post is created then you can set default values with that $customPostType = “customTypeCode”; add_action(“save_post_$customPostType”, function ($post_ID, $post, $update) { if (!$update) { // new item // place to set default values return; } // updating a existing item // … }, 10, 3);
I dug deeper into the warnings and found that it was actually a different method in my class that was causing the error. I have one that creates fields within meta boxes and sets the value attribute to the content of $meta[ $field_id_name ][0]. This is what was causing the notice message. So ahead of … Read more
How to stop post status from reverting to Published?
How to save post_status using action save_post?
It depends on what type of data your array contains. But you would need to first loop your array; and create a valid string for passing into the post_content argument. For example, if your array consisted of text strings: $newArray = array( ‘test_1’, ‘test_2’, ‘test_3’ ); $text=””; // Loop the array and create a text … Read more
You’re passing too many arguments to urlencode. WordPress provides a couple of useful functions for these situations. add_query_arg is a helper to build a URL with query arguments, and esc_url provide sanitation and validations relevant to encoding URLs. Also, wp_title will display or return a combination of the page/post title and a seperator, which doesn’t … Read more
Use Category for Custom Post Type – But Need Another Separate Archive Page too
Your $args array is missing the rewrite argument, specifically with_front, which is what controls whether or not the permalink front is added to the CPT. $args = array( ‘rewrite’ => array( ‘slug’ => ‘portfolio’, ‘with_front’ => false ), // other args… );
Your taxonomy Query is worng. please try something like that: $args = array( ‘post_type’ => ‘contact’, ‘tax_query’ => array( array( ‘taxonomy’ => ‘abteilung’, ‘field’ => ‘term_id’, ‘terms’ => ’29’, ), ), );