Difference between `is_serialized_string` and `is_serialized`

If you check the source code of is_serialized() and is_serialized_string(), the difference will become clear. is_serialized() checks if the data is serialized, whereas is_serialized_string() checks, if the serialized data is of type string. var_dump( is_serialized( serialize(NULL) ) ); // true var_dump( is_serialized_string( serialize(NULL) ) ); // false var_dump( is_serialized( serialize(array(1,2,3)) ) ); // true var_dump( … Read more

*Just curious* I erroneously used hook add_action() instead of add_filter() and there was no error and the result was correct. Why is that?

add_action() uses add_filter() behind the hood. function add_action( $hook_name, $callback, $priority = 10, $accepted_args = 1 ) { return add_filter( $hook_name, $callback, $priority, $accepted_args ); } Source: https://developer.wordpress.org/reference/functions/add_action/ So basically it doesn’t matter if you use add_filter or add_action. But it doesn’t mean you should, using the appropriate function for a event will make your … Read more

What does the raw value for the get_bloginfo’s filter argument exactly do?

We have the following filters added by default (source) add_filter( ‘bloginfo’, ‘wptexturize’ ); add_filter( ‘bloginfo’, ‘convert_chars’ ); add_filter( ‘bloginfo’, ‘esc_html’ ); The bloginfo filter (source) is applied on the get_bloginfo() output, in the display mode, except for the url that has it’s own bloginfo_url filter. The core isn’t using that url filter currently and there’s … Read more

Why is the use of @uses tag in docblocks discouraged?

I’m not 100% sure but I guess it’s because usage of @uses can be covered with @see From phpDocumentor docs @uses is very similar to @see, see the documentation for @see for details on format and structure. The @uses tag differs from @see in two ways. @see is a one-way link, meaning the documentation containing … Read more

Add Option if Not Exists

The logic on the IF THEN ELSE does seem a bit wonky. If I’m reading it correctly… The call to get_option( $option_name ) will return FALSE if the option does not exist or if it has no value. So the IF would be executed: when the option doesn’t exist and $new_value != FALSE the option … Read more

Is the codex no longer actively maintained?

(hmm this is somewhat off-topic, but will let others decide on it) Better answer Although it is hard to track official announcement, as @darmb pointed out in the comments there are indications that the official documentation effort is drifting away from the codex in favor of the developer site, and the “make” blogs/sites. So in … Read more

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