Stop parsing shortcodes

The correct way is calling remove_filter with the same priority as the hook was added: remove_filter( ‘the_content’, ‘do_shortcode’, 11 ); Some plugins change this filter’s priority, so you could clear the global list of registered shortcodes temporary: add_filter( ‘the_content’, ‘toggle_shortcodes’, -1 ); add_filter( ‘the_content’, ‘toggle_shortcodes’, PHP_INT_MAX ); function toggle_shortcodes( $content ) { static $original_shortcodes = … Read more

Calling a shortcode in the backend

As you noticed, the plugin use an instance of the class TablePress_Frontend_Controller to render the shortcode. This instance is created by only on frontend requests, this is the reason why shortcode doesn’t work on backend. The function tablepress_print_table function use the TablePress_Frontend_Controller::shortcode_table method to render the table, and this is the reason why also that … Read more

sql query in shortcode not working

I have worked it out and here are the steps to what I did to get it working created a custom table in the wordpress database (called it wp-products) this table had the following fields: id, make, model, price Created a shortcode to retrieve the price. Shortcode looks like this [product_price id=2] where id=2 is … Read more

Passing attributes to shortcode dynamically

Not quite like that, but you can achieve the same result if you use a pre-defined value or argument in your shortcode to act as a “flag”: [authoorsposts author=”post”] …then in your handler: function wpse_209684_author( $atts ) { if ( ! empty( $atts[‘author’] ) ) { $author = $atts[‘author’]; if ( $author === ‘post’ ) … Read more

Simple contact form with field validation

You don’t have any validation mechanism. Your logic should be somewhat along those lines Submit form Check submitted fields ($_POST) against expected values If all looks good send If something is not as expected, log error ( you can use WP_Error() ) and rebuild form showing error message (and maybe repopulating fields with previous “good” … Read more