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

Hide ID for WordPress User Role Subscriber

You can use the body_class filter and the wp_get_current_user() function to add the current user’s role to the <body> element, and then hide your elements with that (untested): add_filter( ‘body_class’, static function ( $classes ) { $user = wp_get_current_user(); $roles = $user->roles; if ( ! is_array( $roles ) ) { $roles = array( ‘subscriber’ ); … Read more

Why does ‘get_the_ID’ work outside of the loop?

The get_the_ID() function uses the global $post variable, which outside of the loop is sometimes equal to get_queried_object_id(). Within the loop, the $post variable is set to the current post within the loop. As to why get_queried_object_id() is recommended outside of the loop, is because it does not use the global $post variable, so is … Read more

category id (term_id) in url instead of slug

Try this. Here is the full code that you can add to your functions.php file: // Add custom rewrite rules function add_custom_rewrite_rules() { add_rewrite_rule( ‘^category/([0-9]+)/?$’, ‘index.php?term_id=$matches[1]’, ‘top’ ); flush_rewrite_rules(false); // Temporarily set this to true to flush rules, then set back to false } add_action(‘init’, ‘add_custom_rewrite_rules’); // Add term_id to query vars function add_query_vars($vars) { … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)