How to access or parse key/values that have “string”

In it’s current state you would directly get the value from the associative PHP array by directly referencing the key like so: var_dump( $form_data[‘key’] ); It’s wise to note that when you dump variables using var_dump you get information on the value type, and length. So in this case you get string(33) which indicates the … Read more

Link To Child Category For A Post

You can use get_category_link() for that: $allCat = get_the_category(); if( ! empty( $allCat ) ){ $lastCat = array_reverse( $allCat ); $last_cat_link = get_category_link( $lastCat[0] ); if( ! is_wp_error( $last_cat_link ) ){ echo ‘<a href=”‘ . $last_cat_link . ‘”>’ . $lastCat[0]->name . ‘</a>’; } } https://developer.wordpress.org/reference/functions/get_category_link/

Obtaining array item from WordPress revisions output

To get the post author ID you can try: $revisions = wp_get_post_revisions($post->ID); //For first author $first_author = $revisions[0]->post_author; //to get all revision authors foreach( $revisions as $revision ){ echo $revision->post_author; }

Loop over Array and get the distinct ids

No, that’s because you are treating an array as an object and PHP doesn’t convert those types automatically. To get an individual element from an object you use: $my_object->Element1; To get an individual element from an array you use: $my_array[Element1]; You can even nest arrays. So if you have $my_array, where each element is another … Read more

get_users with array as meta_value

First, can use meta_query, but, you should change your values to use the proper date format, e.g. 2020/01/02 for January 2nd, rather than a regional format. See https://en.wikipedia.org/wiki/ISO_8601 for more details. Second, your LIKE query is going to be very expensive, and achieving what you want while still using a LIKE query will be even … Read more

Save data from a checkbox to a wpdb array

This isn’t a WordPress question this is a PHP question. Your foreach loops through all the $checkboxes putting one in the $check variable each time, so your insert() call only inserts the last value for $check, because it’s not inside that foreach loop. You probably want: global $wpdb; foreach( $checkboxes as $check ) { $wpdb->insert(‘data’,array(‘fruit’ … Read more

What form should the $query media query array have for an Elementor page builder function? [closed]

Preface There’s no WordPress-specific stuff in this answer, but I’m just trying to help since the official documentation is (as of writing) not very helpful.. But as I said in the comments, I don’t use Elementor, which means I don’t know much about Elementor’s technical stuff. ( Even the non-technical ones, actually.. 🙂 ) The … Read more