Using jQuery to delete data stored in wp_options

Ajax in WordPress works by sending an HTTP post to /wp-admin/admin-ajax.php (by default) that then fires the corresponding hook. So, you attach some jquery to an event triggered by your delete button, which then posts to admin-ajax.php, which has an action, say, delete_my_options(), which actually runs the php to delete. Then, you have a function, … Read more

How to store widget fields data as an array?

You have to collect multiple fields under the same name like this … name=”collect[1]” name=”collect[2]” … and adjust your widget logic to this. Here is a very simple demo widget: <?php # -*- coding: utf-8 -*- /* Plugin Name: Store Options as array */ add_action( ‘widgets_init’, array ( ‘T5_Array_Options_Widget’, ‘register’ ) ); class T5_Array_Options_Widget extends … Read more

Enable page templates. How?

Chances are that the theme you’ve switched to has no page templates defined – they exist on a per theme basis. Here’s the Codex reference: https://wordpress.org/support/article/pages/

How to load WordPress on non WP page?

The shortest way is to load wp-load.php and abort the loading of the template engine (Note: You couldn’t do that, if you’d be loading the header file, like you see it on many sites in the interweb). # No need for the template engine define( ‘WP_USE_THEMES’, false ); # Load WordPress Core // Assuming we’re … Read more

Please explain how WordPress works with MySQL character set and collation at a low level

There are two defines in wp-config.php of WordPress website: define(‘DB_CHARSET’, ‘utf8’); define(‘DB_COLLATE’, ”); There are several things which are most commonly misunderstood. Names of constants in those defines, might suggest that they are related to the database itself. They are not. They are related to tables within the database. Database creation is totally independent from … Read more

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