How to update taxonomy custom field with wp_update_term()?

wp_update_term does not support custom fields so you will need to use update_term_meta instead. This stores values like this: update_term_meta( $term_id, $metakey, $metavalue ); Your code should look something like this: update_term_meta( 41, ‘clpr_store_url’, $url); update_term_meta( 41, ‘clpr_store_aff_url’, $url);

Integrate post tags in Post Edit page with qTranslate

When user starts typing something into tag input, JavaScript makes request to admin-ajax.php with action set to ajax-tag-search to receive list of suggestions (if any). In that file that action is recognized as belonging to core and wp_ajax_tag_search() function is added to dynamically generated wp_ajax_ajax-tag-search hook, which fires almost immediately after that. Looking at source … Read more

Create taxonomy with meta term using the WP Rest Api

I think you need an update_callback in register_rest_field(). Please note that I haven’t tested this. add_action( ‘rest_api_init’, ‘slug_register_meta’ ); function slug_register_meta() { register_rest_field( ‘place’, ‘meta’, array( ‘get_callback’ => ‘slug_get_meta’, ‘update_callback’ => ‘slug_update_meta’, ‘schema’ => null, ) ); } function slug_get_meta( $object, $field_name, $request ) { return get_term_meta( $object[ ‘id’ ] ); } function slug_update_meta($value, $object, … Read more

How to return a list of custom taxonomy terms via the Gutenberg getEntityRecords method

The getEntityRecords() method uses the REST API, so make sure the taxonomy is enabled for the REST API. You can enable it via the show_in_rest parameter when registering the taxonomy using register_taxonomy(). With getEntityRecords(), if you set per_page to -1, it will actually be changed to 100, which as you’ve figured it out, is the … Read more

Set a cookie in WordPress, using a select form and Jquery

If you don’t give the cookie an expires time it will only be available during that session. You will also need to destroy an existing cookie if it is already set. jQuery(function() { jQuery(‘#categoriesform’).submit(function(e) { if (jQuery.cookie(‘my_cookie’) ) { jQuery.cookie( ‘my_cookie’, null) } jQuery.cookie(‘my_cookie’, ‘my_value’, { expires: 30 }); }); }); Have you tested to … Read more

Create an archive page for custom taxonomies

It looks like your issue is the name of your taxonomy has a capital letter, the first argument of register_taxonomy is to be all lowercase, no spaces as the documentation for the register_taxonomy function mentions here. Change your code to the following and your taxonomy-gallery.php template will work correctly. register_taxonomy( ‘gallery’, array( ‘photo’ ), array( … Read more

How to set individual capabilities on a taxonomy? Or how to re-register an existing taxonomy?

This should works add_action( ‘init’, ‘register_category_again’, 1 ); function register_category_again() { $user = wp_get_current_user(); if ( $user->roles[0] != ‘your_custom_role’ ) return; global $wp_taxonomies; unset( $wp_taxonomies[‘category’] ); global $wp_rewrite; $rewrite = array( ‘hierarchical’ => true, ‘slug’ => get_option(‘category_base’) ? get_option(‘category_base’) : ‘category’, ‘with_front’ => ! get_option(‘category_base’) || $wp_rewrite->using_index_permalinks(), ‘ep_mask’ => EP_CATEGORIES, ); register_taxonomy( ‘category’, ‘post’, array( … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)