$wpdb not working wordpress plugin ajax call

The reason your wpdb call fails is because there is no wpdb. You’ve taken the incorrect route of using a standalone PHP file, so there is no WordPress API. WordPress never gets loaded. That’s not how you do AJAX in WordPress. The solution is to do the AJAX call correctly and register a REST API … Read more

Image path in childs theme

Use the ABSPATH constant defined in the wp-config.php: $filename = ABSPATH . ‘wp-content/uploads/webcam/webcamimage.jpg’; You don’t have to use basename() function since it would return only the last component from the full file path, i.e. webcamimage.jpg, and it isn’t what you want to use with filemtime() function.

how to display data from user panel using cmb2 metabox?

According to CMB2 documentation, instead of <img src=”<?php echo get_post_meta( get_the_ID(), ‘author_sign’, true) ?>” alt=””> you should use something like <?php echo wp_get_attachment_image( get_post_meta( get_the_ID(), ‘author_sign’, true ), ‘medium’ ); ?> or <img src=”<?php echo wp_get_attachment_image_url( get_post_meta( get_the_ID(), ‘author_sign’, true ), ‘medium’ ); ?>” alt=””>

Adding an item to an anonymous array inside a filter?

I added the capabilities now through this code. I’m not happy with my solution and it would be great if someone could find a proper way to add to the filter. I would be honestly interested to know how to make it properly work. add_action( ‘admin_init’, ‘jp_add_atum_caps_to_shop_manager’); function jp_add_atum_caps_to_shop_manager() { if(!user_can( 217 , ‘atum_read_inbound_stock’)) { … Read more