Showing WP_Error message with admin_notice action hook

You can use function add_settings_error. More details can be found in the WordPress documentation. I have edited your previous answer to include that: function wpse_189722_limit_tag_words( $term, $taxonomy ) { if ($taxonomy === ‘post_tag’) { if ( count( preg_split( ‘/\s+/’, trim( $term ) ) ) > 2 ) { add_settings_error(‘term_too_many_words’, ‘term_too_many_words’, ‘Maximum of 2 words allowed, … Read more

Is it possible to disable caching of an option when using w3 total cache?

okay, here we go. try this: in your functions.php modify the behaviour of ai1ec_options: $ai1ec_options = get_option(‘ai1ec_options’); delete_option(‘ai1ec_options’); add_option(‘ai1ec_options’, $ai1ec_options, ”, ‘no’); // thanks for your suggestion 🙂 be careful though, as you might lose your set options, so be sure to get them from the database first. or create a backup option. afterwards, clear … Read more

How to use WP_Error $data argument?

$this->error_data[$code] … the WP_Error object holds $data in an array and $code is the key. The add_data method clearly states: The error code can only contain one error data. But the $data (mixed) can be an array or an object and carry as many keys/properties as you need. It’s up to your handlers how they … Read more

$wpdb->prepare() warning in WordPress 3.5

Remove the call to $wpdb->prepare(): $result = $wpdb->get_var( “SELECT DISTINCT meta_value FROM $metatable WHERE meta_key LIKE ‘%matchme%’ AND meta_value IS NOT NULL AND meta_value <> ”” ); In this case, the $wpdb->prepare() function is not doing anything. There are no variables holding unknown values, therefore there is no need to sanitize them. If you did … Read more

Debug mode shows Strict Standards

Just don’t set WP_DEBUG to TRUE. The error level is set in wp_debug_mode(), which is called in wp-settings.php before any plugins are loaded. If you leave the default values WordPress will set it to: error_reporting( E_CORE_ERROR | E_CORE_WARNING | E_COMPILE_ERROR | E_ERROR | E_WARNING | E_PARSE | E_USER_ERROR | E_USER_WARNING | E_RECOVERABLE_ERROR ); But you … Read more

Error 404 Page Not Found When Updating a Post or Page

Updating Permalink changes update your permalinks settings and flush rewrite rules. In most cases this fixes the WordPress posts 404 error. BTW, you already tried this and I hpe your .htaccess should be writable. Have you checked it? If not then you can change .htaccess file permission temporary writable by changing the permissions to 666 … Read more

$wpdb->last_error doesn’t show the query on error

If you want the query, that’ll be $wpdb->last_query (note that you also do not need SAVEQUERIES, that’s only if you want a log of every query ($wpdb->queries) last_error is… well, the error! Update: Possible explanation for last_error being empty – this is the source of wpdb::query(): // If we’re writing to the database, make sure … Read more

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