Trying to GET data with ajax from database and show in fullcalendar

There were a couple security issues and error checking that I did see. Try these: <?php add_action(‘wp_ajax_get_timeslot_data’, ‘get_timeslot_data’); add_action(‘wp_ajax_nopriv_get_timeslot_data’, ‘get_timeslot_data’); function get_timeslot_data() { if (!isset($_POST[‘activityId’]) || !ctype_digit($_POST[‘activityId’])) { wp_send_json_error(“Invalid activity ID”); } global $wpdb; $activity_id = intval($_POST[‘activityId’]); $table_name = $wpdb->prefix . ‘booking_seasons’; // Support custom table prefixes $result = $wpdb->get_row($wpdb->prepare(“SELECT timeslot_dates FROM $table_name WHERE id … Read more

‘apply_filters’ is breaking some shortcodes/HTML but not all

try this: function reload_article_content() { check_ajax_referer( ‘reload_article_nonce’, ‘security’ ); $post_id = intval( $_POST[‘post_id’] ); // only run on posts where ‘is-live’ custom field is set to ‘true’ if ( get_post_meta( $post_id, ‘is-live’, true ) === ‘true’ ) { $post = get_post( $post_id ); if ( $post ) { $GLOBALS[‘post’] = $post; setup_postdata( $post ); ob_start(); … Read more

/wp-admin/admin-ajax.php Error 500 while using divi premade layout in existing pages

Increase the memory_limit in the wp-config.php by adding: define(‘WP_MEMORY_LIMIT’, ‘256M’); Or, go to your wp-config.php file in your root directory, Change this line: define(‘WP_DEBUG’, false); to; define(‘WP_DEBUG’, true); define(‘WP_DEBUG_LOG’, true); define(‘WP_DEBUG_DISPLAY’, false); this will log any errors you’re having with additional information in wp-content/debug.log file. From your comment, it seems a process or theme/plugin is … Read more

WP_Query with multiple categories unexpected behavior

To get an array from a form POST into PHP, you have to name the form variable with square brackets: <html> <body> <pre> <?php var_export( $_POST ); ?> </pre> <form action=”” method=”post”> <label> 4<input type=”checkbox” name=”cats[]” value=”4″></label> <label> 5<input type=”checkbox” name=”cats[]” value=”5″></label> <label> 6<input type=”checkbox” name=”cats[]” value=”6″></label> <input type=”submit” value=”Submit”> </body> </html>

Getting featured image from WP_Query

Suggest to reformat the data like such (untested): function load_more_blogs() { … $results = array(); foreach ( $query->posts as $post ) { $results[] = array( ‘post’ => $post, ‘image’ => get_the_post_thumbnail( $post->ID, ‘post-thumbnail’ ), ); } wp_send_json_success( $results ); exit(); } This will give you an array of arrays, with the inner array have two … Read more