Forum Replies Created
-
AuthorPosts
-
Anh Tran
KeymasterHi,
Yes, it's possible.
You can use the
taxonomy_advancedfield, and set thefield_typetoselect_advanced(default) and enablemultipletotrue, like this:'fields' => [ [ 'id' => 'purchased_tags', 'type' => 'taxonomy_advanced', 'taxonomy' => 'your_tax', 'name' => 'Apply tags when purchased', 'field_type' => 'select_advanced', 'multiple' => true, ], // Other fields ]Anh Tran
KeymasterHi David,
Thanks for your feedback. Yes, I want to complete this thing as it's important and I don't want to postpone at the middle.
Regarding your feedback:
- I think sanitize_textarea_field is too limited. It seems fine with the function name, but people usually use it for HTML content. I'm using wp_kses_post, which I think is okay.
- Adding params for wp_kses_post can be done. But it will make the code more complicated in both plugin's side and developer's side. I think in this case, developers can do that easier with a custom sanitize callback like this:
'sanitize_callback' => function( $value ) { $allowed_tags = []; return wp_kses( $value, $allowed_tags ); }- I'm thinking about this, too. Need to find a good way to implement that without breaking things.
- That's available via custom
sanitize_callbackparam (see the example above). Developers can define their own sanitize callback or bypass the sanitization with this code:
'sanitize_callback' => function( $value ) { return $value; }August 15, 2019 at 11:43 PM in reply to: ✅Some field types are not displayed within the block #15710Anh Tran
KeymasterHi,
Are you using the AIO plugin or MB Blocks plugin individually? I fixed this bug in MB Blocks, but haven't deployed to API yet.
Anh Tran
KeymasterHi David,
Glad you like it. I've just pushed the finished code to the "sanitize" branch. The full code is now available here.
There are also some things left that I would love to hear your feedback:
- textarea field: at the moment, I force to use
wp_kses_postas default. But as I said in a reply earlier, some developers make this field available for users to enter scripts (such as Google Analytics or Google Adsense). What do you think best in this way? Is forcing a callback is good? - Custom field type are not sanitized by default. Developers are required to sanitize themselves. Do you think it's fine? Or forcing a default sanitize callback?
Anh Tran
KeymasterHi,
This is similar to what we've done in the MB REST API plugin. Please take a look at the plugin code to see how it's done.
Anh Tran
KeymasterHey guys,
I added some sanitization callbacks. More will come later. The full code of the sanitization is here.
This is the 1st step on this. Any feedback is welcomed.
Anh Tran
KeymasterYes, that can be done with this filter:
https://docs.metabox.io/actions/#rwmb_field_id_after_save_field
add_action( 'rwmb_YOUR_FIELD_ID_after_save_field', function( $null, $field, $new, $old, $object_id ) { $term_ids = $new; if ( $field['clone'] ) { $term_ids = []; foreach ( $new as $clone_value ) { $term_ids = array_merge( $term_ids, $clone_value ); } } wp_set_post_terms( $object_id, $term_ids, 'YOUR_TAXONOMY' ); }, 10, 5 );Anh Tran
KeymasterHi,
Did you change the code for fields when migrating the site? That might be the problem. The structure of the meta box and fields need to be the same in the previous site.
You can also try to
var_dumpthe value (sometimes you need tounserializeit first if that's a group), to see the data structure. And verify that with the meta box/fields structure to make sure they match.Anh Tran
KeymasterI see. Removing the "content" from the shortcode breaks the date picker. I've just fixed it in this commit. Please try it. The new version is coming soon.
Anh Tran
KeymasterHi Mary,
I've just checked and couldn't replicate the error. I recorded a video here:
https://www.loom.com/share/b309930905274434abebd1ab3c7ef0ea
Please take a look.
If you still see the problem, please send me more details or a temporary admin account via the Contact form. I'll take a closer look to your site.
Anh Tran
KeymasterThis bug is fixed in version 1.0.3. New version for AIO will come a little later.
Anh Tran
KeymasterHi Ryan, this bug is fixed in this commit.
Anh Tran
KeymasterOh, I see the problem. After saving, only the 1st input has the filter working. I'll fix it now.
August 10, 2019 at 3:18 PM in reply to: ✅Taxonomy Advanced - display category thumbnail image #15666Anh Tran
KeymasterHi Wojtek,
If you're on a category/term page, then you can get the term id with
get_queried_object_id(). You can also get full term object withget_queried_object().Anh Tran
KeymasterHi Mary,
Do you see any error in the browser console?
-
AuthorPosts