how create an html table with all values from a serialized array in option_value

Don’t know how you stored your data. Just answering from assumption: <?php $options = get_option(‘all_names’); ?> <table> <tbody> <?php $_counter = 0; foreach( $options as $option ) : ?> <tr> <td><?php echo $option[‘block1_names_arr’][$_counter]; ?></td> <td><?php echo $option[‘block2_names_arr’][$_counter]; ?></td> </tr> <?php $_counter++; endforeach; ?> </tbody> </table>

Automate WordPress website setup with prefilled data

I’ve had great luck with scripting WP-CLI to install, setup and configure WordPress development, staging, and production sites. With it, you can automate nearly the entire process including the installation of specific plugins, the creation of menus, categories, and just about any WordPress configuration item. Obviously, this approach would require shell access and the installation … Read more

How to use update_option() without replacing/losing the old value?

Use update_option() in conjunction with get_option(): $old_option = get_option(‘blogdescription’); $new_option = ‘My new blog description’; $new_option .= $old_option; // This is the same as $new_option = $new_option . $old_option; update_option(‘blogdescription’, $new_option); If they are integers, obviously use something like $new_option += $old_option.

How to show every second user different types of banners?

Instead of using the Options API, you’d be better off using the Transients API, however in either case you’ll be polluting the *_options table (even if you use transients with expiration times). I’d possibly recommend using wp-session-manager plugin by EAMann’s which will allow you to use and store $_SESSION data in a dedicated sessions database … Read more

OceanWP settings are missing from Add New Post [closed]

It looks like you can hook into the ocean_main_metabox_capabilities filter: It is defined in /plugins/ocean-extra/includes/metabox/metabox.php: $capabilities = apply_filters( ‘ocean_main_metaboxes_capabilities’, ‘manage_options’ ); In your child theme or a custom plugin, try the following (for example, in /themes/mytheme/functions.php: add_filter( ‘ocean_main_metaboxes_capabilities’, ‘my_custom_metabox_role’ ); /** * Change the default role used to display the Ocean Extra metabox. * * … Read more

Block properties, attributes and settings

Settings is what you define in registerBlockType() in the block.js file. Here you have to add most basic settings like title:, category: and icon:. (Handbook link). Attributes are optional, also in registerBlockType(). You can extract values from markup i.e. for saving the block content (Handbook link). Properties get passed from the editor. You can find … Read more

update_option_$option action not working as expected

Looks like update_option_{$option} will only fire on updated options, ie, not brand-new ones. Reading the code for update_option(), I see this: /** This filter is documented in wp-includes/option.php */ if ( apply_filters( “default_option_{$option}”, false, $option, false ) === $old_value ) { // Default setting for new options is ‘yes’. if ( null === $autoload ) … Read more

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