How to create plugin settings page for each admin user?
How to create plugin settings page for each admin user?
How to create plugin settings page for each admin user?
I had the same problem and in my case the reason why it didn’t work was that: I use Divi in functions.php Divi has function et_divi_maybe_change_frontend_locale and it returns ‘en_US’ by default. Just change ‘en_US’ to your language. Remember to use a child theme if you’re modyfying functions.php
You are misspelling the variables names. You define them as $new_value and $old_value with underscore that you forgot about. Except this your code working fine. function myplugin_update_field_foo( $new_value, $old_value ) { if ($new_value !== $old_value && is_array($old_value) && is_array($new_value)) { $new_value = array_unique( array_merge( $new_value, $old_value ) ); } return $new_value; } To get the … Read more
If $_POST[‘exclude_posts’] is an array but you need to store it as a string, you can always use a function like serialize() and unserialize() to turn it into a string and vice versa. http://php.net/manual/en/function.serialize.php
From a WordPress perspective, there’s not a lot to configure for performance. You can set define( ‘WP_DEBUG’, false ); in your wp-config.php to disable logging, which will gain you some minimal savings. Beyond that, I would recommend working on making sure your heavier plugins are optimized as best as you can, reduce the number of … Read more
Here is possible solution that works (theme name is “zoran”): //1. Step (Create Customizer section, setting, control) //In functions.php include or directly put code that goes something like this: function zoran_customize_register( $wp_customize ) { $wp_customize->add_section( ‘zoran_sekcija’, array( ‘title’ => __( ‘Zoran’, ‘zoran’ ), ‘priority’ => 35, ) ); $wp_customize->add_setting( ‘zoran_postavka’, array( ‘default’ => ‘container’, ‘type’ … Read more
If you want to use multiple options pages for plugin, ensure that your sanitize function gets the additional missing options from the database example public function sanitize($input): array { /** My Plugin Setting Options */ $option = get_option(‘my_plugin_settings’); /** Do this for all the settings keys in your options array */ if ($input[‘setting_key’]) { $output[‘setting_key’] … Read more
I managed to figure this out. It was because on the template page where I output the form I had forgotten to include the settings_fields function, so it was not saving the setting. I added the following code below to that page and then it worked: <?php settings_fields(‘prev-next-setting’); ?>
I have managed to do the following. I made a clear cache button: function advanza_direct_plugin_delete_transients() { delete_transient( ‘advanza_direct_terms_of_service’ ); delete_transient( ‘advanza_direct_privacy_policy’ ); // at the end redirect to target page exit( wp_redirect( admin_url( ‘admin.php?page=advanza-direct-plugin-settings’ ) ) ); } add_action( ‘admin_post_advanza_direct_plugin_delete_transients’, ‘advanza_direct_plugin_delete_transients’ ); I put this where I have my admin logic: <form action=”<?php echo admin_url(‘admin-post.php’); … Read more
Some entries delete_option doesn’t work