I have an error WordPress database error: [You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version

The problem here you are passing table name as a placeholder in prepare statement. Which is not allowed. You can directly add the table name in your query without quotes. Your query do not have any placeholder and arguments. So No need for prepare statement. Try following code. global $wpdb; $vragen = $wpdb->get_results( “SELECT * … Read more

Renaming the ‘build’ directory generated by @wordpress/scripts for React development

I am writing this answer after testing the suggestion given by @SallyCJ (thank you for pointing me towards the right direction) Writing the following entry into the scripts section of package.json will change both the source and destination of the React code. “scripts”: { “build”: “wp-scripts build –webpack-src-dir=path/to/source/dir/ –output-path=path/to/destination/dir/”, “test”: “echo \”Error: no test specified\” … Read more

Custom RSS causing timeout for website

As @TomJNowell mentioned it’s weird to use get_headers() for this. It would be better to remove the $img variable entirely and just use strlen() in your enclosure to get the length of the string in bytes: <enclosure url=”<?php if ( has_post_thumbnail( $post->ID ) ) { the_post_thumbnail_url(); } ?>” length=”<?php if ( $image ) { echo … Read more

How call WordPress shortcode inside function file

I need echo do_shortcode(‘[Shortcode]’); to go where it says “New Item Contents here!” is there any way to do this? Just put it there: add_action( ‘woocommerce_account_new-item_endpoint’, ‘add_new_item_content’ ); /** * Add content to the new tab. * * @return string. */ function add_new_item_content() { echo do_shortcode(‘[Shortcode]’); } Maybe I’m misunderstanding the question, but that’s all … Read more

get_query_vars always retruns empty value

In my test scenario I use the original twentytwentyone theme with no plugins activated. My code is placed at the end of functions.php. This is the problem. Your code is running as soon as functions.php is loaded, which is before the query vars are populated. If you use get_query_var() inside an action hook that runs … Read more