Forum Replies Created
-
AuthorPosts
-
vacdk
ParticipantHi, I forgot to mention I have set the CPT to the users and not post.
Here is a recording, it seems its sorting the users and not the numbers.vacdk
ParticipantSo, after some digging, I think I got it to work.
add_action( 'rwmb_galleri_upload_after_save_field', function ( $null, $field, $new, $old, $object_id ) { $args = array( 'post_type' => 'attachment', 'numberposts' => null, 'post_status' => null, 'post_parent' => $object_id ); $attachments = get_posts($args); if ($attachments) { foreach ($attachments as $attachment) { wp_set_object_terms( $attachment->ID, 'Galleri', 'happyfiles_category', false ); } } }, 10, 5 );is this the right way to do it ? or is there an easier way ?
vacdk
ParticipantThanks Long
But the lack of documentation or examples I can not get it to work.
In this example, I am just trying to update a text field after saving.
Text field ID =text_plo7fflsjjpadd_action( 'rwmb_text_plo7fflsjjp_after_save_field', function ( $null, $field, $new, $old, $object_id ) { $settext = 'updated'; update( $field["id"], $settext , $new ); }, 10, 5 );but i am getting a Fatal error: Uncaught Error: Call to undefined function update()
vacdk
ParticipantThanks for the reply
The Avatar image is already hooked to the user profile, so it's not possible also to add it to the attachment, I know ACF can hook to multiple locations posts, pages, users but I don't see the option in MB.
As written in the earlier post, the Happyfiles plugin has already created the taxonomy.
I just want to set a taxonomy argument on the image upload. Hidden, as users shall not be able to select different options.I tried with JSON notation, but no luck.
CUSTOM SETTINGS
ex. tax_query = [{"happyfiles_category": "avatar", "term_id": "20", "slug": "avatar"}] -
AuthorPosts