Getting timestamp of activation plugin time

You’ll have to use get- and add_option inside a register_activation_hook. <?php register_activation_hook(__FILE__,’save_activation_timestamp’); function save_activation_timestamp() { add_option(“myplugin_activation_timestamp”,mktime()); } ?> You can find an entire tutorial on that at CodeYoghurt. It even mentions your case as an example.

WP_Editor – Saving Value into Plugin Option – Stripping HTML

The Problem This turned out to be a common case of needing to use stripslashes();. How did I figure this out? I logged into phpMyAdmin, navigated to the options table, found my option name, and edited it. Here’s what I discovered… s:11:”description”;s:90:”<span style=\”text-decoration: underline;\”>This is supposed to be underlined text.</span>”; So obviously my plugin is … Read more

Checkbox Undefined index error in Plugin

You shouldn’t put quotes around the index for HTML names – otherwise you end up with ‘single_images’ (including single quotes) as the PHP name (so you’d have to address it $iwmp_options[“‘single_images'”], which some might consider confusing) … eg: add_action( ‘admin_init’, function () { register_setting( ‘iwmp_settings’, ‘iwmp_settings’ ); add_settings_section( ‘single_images’, __( ‘Single Images’, ‘iwmp_domain’ ) , … Read more

Issue regarding $wpdb->prepare()

prepare() is used to escape the values for example in the WHERE-statement. Usually it is anticipated the table selection is “hardcoded”. If you can’t use for example $wpdb->posts or the other “table”-functions, you could whitelist the allowed tables and check if $table_name is on this white list: <?php $allowed_tables = array( $wpdb->prefix . ‘nametbl’, $wpdb->prefix … Read more