A $_POST should occur when submit form but is not?

Add this to functions.php add_action(‘wp_ajax_post_language’,’post_language’); and then make either of following changes in your code. Because your jquery code is sending FirstNM to server (not FirstName). Therefore in post_language() function, change this line $FirstName = isset( $_POST[‘FirstName’] ) ? $_POST[‘FirstName’] : ”; to $FirstName = isset( $_POST[‘FirstNM’] ) ? $_POST[‘FirstNM’] : ”; OR Change ‘FirstNM’: … Read more

I can’t update my data through $wpdb

You’re missing your where statement. You need to tell wpdb which row it should be updating, otherwise you’re looking to insert rather than update. From the $wpdb::update Codex: wpdb->update( string $table, array $data, array $where, array|string $format = null, array|string $where_format = null );

PHP error when using newer PHP versions

Please try to change that line to comment_form( array( ‘fields’ => $fields, ‘label_submit’ => esc_attr__( ‘Submit’, ‘Divi’ ), ‘title_reply’ => ‘<span>’ . esc_attr__( ‘Leave a comment’, ‘Divi’ ) . ‘</span>’, ‘title_reply_to’ => esc_attr__( ‘Leave a Reply to %s’, ‘Divi’ ), ‘class_submit’ => ‘submit et_pb_button’, ‘comment_notes_before’

How to get category name or ID by post?

Please try below updated code <?php $recent_posts = wp_get_recent_posts(array( ‘post_status’ => ‘publish’, ‘cat’ => ”, )); foreach($recent_posts as $post) : ?> <div class=”card”> <div class=”card-bg”> <div class=”card-cat”> <?php $category_detail=get_the_category($post[‘ID’]);//Pass POST ID foreach($category_detail as $cd){ echo $cd->cat_name.”; } ?> </div> <img class=”card-img” src=”https://wordpress.stackexchange.com/questions/337072/<?php echo get_the_post_thumbnail_url( $post[“ID’] ); ?>”> </div> <div class=”card-body”> <div class=”card-title”> <?php echo $post[‘post_title’] … Read more

Conditional multidimensional arrays and array_map

returns with an error (array_map(): Argument #2 should be an array), as no array is present The $states[‘s_bib_source_c_bib_sources’] ?? [] is only setting $states[‘s_bib_source_c_bib_sources’] if it isn’t already set. If it’s set and it’s not an array, then array_map would throw the “should be an array” error. So you might better off use type-casting: isset( … Read more

use loop to return blog details

You need to re-arrange your code. <?php $post_id = 20; while($post_id <= 25) { $queried_post = get_post($post_id); $author_id = $queried_post->post_author; echo get_the_author_meta(‘display_name’, $author_id); $post_id++; } ?> Within while loop above you have $queried_post which is an object of class WP_Post. Member Variables of WP_Post can be used to display data about each post. I hope … Read more

trying to get wp_get_attachment_url to output clickable link

You’re onto the answer… The function, wp_get_attachment_url() (see Codex) just gives you the URL. You could wrap it in a link: echo ‘<tr><td><a href=”‘ . esc_attr(wp_get_attachment_url($row[‘item_code1’])) . ‘”>’ . esc_html($item_1_title) . ‘</a></td></tr>’; Alternately, you can use wp_get_attachment_link() (see Codex) as you mentioned: echo wp_get_attachment_link($row[‘item_code1’], ‘medium’, false, false, esc_html($item_1_title)); Neither is specifically better all the time, … Read more

Shortcode for Listing Users from Meta Value?

It’s a small coding mistake.. It’s not displaying anything because when there are results, the end output is always a </ul> because you’re always overwriting the $results and not appending output to the variable: $results=”<ul>”; foreach ($users as $user){ $results=”<li>” . $user->display_name . ‘</li>’; } $results=”</ul>”; So the proper code is: $results=”<ul>”; foreach ($users as … Read more