Tag Info

Hot answers tagged

5

I think, not 100% sure that this was the real reason the WP developers took this approach, but common sense tells me that serialize preserves the variable types and have a mini built in error detection, and json stores only string values { key : value }, so when you go back to PHP you will have to guess the format, or make a parser for it. This will force ...


2

I am tempted to close this as "subject to opinion" but I think there are a couple of good answers to the question. I am going to go with "history". 1) json_encode is relatively new in PHP core. json_encode (PHP 5 >= 5.2.0, PECL json >= 1.2.0) json_encode — Returns the JSON representation of a value ...


2

JSON encoding was introduced in PHP 5.2, WordPress is way older, and it was born (and designed for) PHP 4. Data serialization is a pervasive thing in WordPress, so moving from PHP serialization to JSON encoding would mean a huge backward compatibility problem, and if I know WordPress a little, that will never happen. That said, if you think that JSON ...


2

Those are php serialized constructs. The one you have there is an array. If you are looking to read them as a human, it breaks down like this: Array: a:size:{key definition;value definition;(repeated per element)} String: s:size:value There are other possibilities that you can read more about here. Generally, you should never modify these directly ...


1

Use $wpdb->base_prefix . 'table_name' as a table name when you want to create a table for the whole network, or when you want to run queries on it. $wpdb->base_prefix is always the prefix for the current network’s main table.


1

You should create a table only on activation, if is not created, exist in the database. A small source example should help you. The follow source create a table, also in single sites, maybe the plugin will activate in single mode for each side in the network. register_activation_hook( __FILE__, 'on_activate' ); function on_activate() { create_table(); ...


1

Lead dev of Redux here. You can use one of our filters to match your needs: "redux/validate/{$this->args['opt_name']}/defaults" - Only on resetting defaults "redux/validate/{$this->args['opt_name']}/defaults_section" - Only on resetting one section "redux/options/{$this->args['opt_name']}/import" - Only on import ...


1

Before you get to relating things in WordPress, you should decide what things are. In a very nutshell there are: Posts of post types (native ones being pages and blog posts) Terms of taxonomies (native ones being tags and categories) There are some things that WordPress does smoothly out of the box. Such as post being assigned a term or term having a ...



Only top voted, non community-wiki answers of a minimum length are eligible