Can I use a form in a dashboard widget?

There are two options to use forms in a dashboard widget: Use the parameter control_callback. See the Codex wp_add_dashboard_widget( ‘my_id’, // $widget_id ‘my_name’, // $widget_name ‘my_render_widget’, // $callback ‘my_control’ // $control_callback ); function my_control() { // print some form elements, WordPress will handle the <form> tag. } If you want to use a form in … Read more

Advice and plugins against Malware [closed]

WordPress is inherently quite secure software, because of open source, extremely wide installation base and reasonably fast security updates. There is no such thing as security plugin that magically increases security, while causing no conflicts. Security plugins either act to monitor situation and inform you after the fact (important, but it’s not prevention measure) or … Read more

How use %like% in sql statement wordpress

$wpdb->prepare() doesn’t actually fully support sprintf() placeholders. From the Codex: The query parameter for prepare accepts sprintf()-like placeholders. The %s (string), %d (integer) and %f (float) formats are supported. It’s not entirely obvious from that but the argument swapping formats (e.g. %1$d) are not supported (in any case you have the incorrect syntax: it should … Read more

How to trigger an action with a URL

As @toscho says you need an endpoint. Note code is untested. /** * Flush rewrite rules */ function install_my_plugin() { my_plugin_endpoint(); flush_rewrite_rules(); } register_activation_hook( __FILE__, ‘install_my_plugin’ ); /** * Flush rewrite rules */ function unistall_my_plugin() { flush_rewrite_rules(); } register_deactivation_hook( __FILE__, ‘unistall_my_plugin’ ); /** * Add the endpoint */ function my_plugin_endpoint() { add_rewrite_endpoint( ‘action’, EP_ROOT ); … Read more

WooCommerce – results per page not working after page reload

Let’s imagine you got a dropdown like the following // The template tag that you place in your … template function WPSE116198PerPageSelect() { $selected = <?php <select name=”woo_per_page” id=”woo_per_page” size=”3″> <?php foreach ( array( 24, 36, 48 ) as $val ) { ?><option <?php value=”<?php echo $val; ?> selected( get_query_var( ‘woo_per_page’ ), $val ); ?>> … Read more