How can I write slugs / permalinks as: custom post type -> custom taxonomy and custom post type -> custom taxonomy (one CPT and many taxo)?

Thanks to Sally CJ, here is the solution that worked for me : /*To create new custom taxonomy */ function si0b_ct_year() { /* Property Type */ $labels = array( ‘name’ => _x(‘Years’, ‘Taxonomy General Name’, ‘siobanone’), ‘singular_name’ => _x(‘Year’, ‘Taxonomy Singular Name’, ‘siobanone’) ); $rewrite = array( ‘slug’ => ‘artistes’, ‘with_front’ => false, ‘hierarchical’ => … Read more

Disable button after one click per user per post

Use a user meta entry to store the information that this user has received the coupon already. Then check this user meta before you print the button: Plugin code: function coupon_button() { $post_id = get_the_ID(); $user_id = get_current_user_id(); $coupons_received = (array) get_user_meta( $user_id, ‘coupons_received’, true ); if ( in_array( $post_id, $coupons_received ) ) return ”; … Read more

Custom taxonomy returns 404 even with saving permalinks

I’ve found my solution.. In my functions.php I found the following functions which returns a 404 on several types: function remove_wp_archives(){ //If we are on category or tag or date or author archive if( is_category() || is_tag() || is_date() || is_author() || is_tax() ) { global $wp_query; $wp_query->set_404(); //set to 404 not found page status_header(404); … Read more

How can I create a button that when clicked populates a div with a list of foods that are checked as a certain type of ACF?

First I’d recommend you to make sure $meal_type = get_field(‘meal_type’); returns array of strings – to do this you can simply call var_dumb($meal_type) after getting this field value. So for example if you’ve used a Repeater field for meal_type, you’ll see array of arrays and not array of strings. Also It’s kind of strange thing … Read more