I want to display the content of a text field only if it has been entered

Do echo inside an if statement. function show_my_message() { $settings = get_option(‘wc_checkout_message_settings’); //Check if the array is set if( isset($settings[‘wc_checkout_message_text_field_0’]) && !empty($settings[‘wc_checkout_message_text_field_0’]) ){ echo $settings[‘wc_checkout_message_text_field_0’]; } //Check the other value and show it if(isset($settings[‘wc_checkout_message_text_field_1’]) && !empty($settings[‘wc_checkout_message_text_field_1’]) ){ echo $settings[‘wc_checkout_message_text_field_1’]; } }

Best practices/popular methods for distributing a program with a plugin?

their rules specifically say Externally loading code from documented services is permitted. however all the related examples are about javascript or wordpress plugins. Management services that interact with and push software down to a site are permitted, provided the service handles the interaction on it’s own domain and not within the WordPress dashboard. which doesn’t … Read more

Load my plugin before cache

By default WordPress first checks for any must-use plugins (plugins in the optional mu-plugins folder) and loads those. So the first plugins loaded will be those located in /wp-content/mu-plugins folder Then, if you’re running a multisite installation, it checks for plugins that are network-activated and loads those. Then it checks for all other active plugins … Read more

Is there such a thing as a WordPress console?

If you want to see notices/messages in the admin area, try ‘Admin Notices’ . See https://codex.wordpress.org/Plugin_API/Action_Reference/admin_notices . A good tutorial is here: https://www.wpbeginner.com/wp-tutorials/how-to-add-admin-notices-in-wordpress/. I recommend setting the ‘is_dismissable’ class in the HTML of the message you want to display. That will allow you to close/exit the notice.

Help me with my first very basic plugin

I have already answered this question stackoverflow, but adding the answer here as well: Looking on the code it does not seem like the WordPress way of doing this kind of thing. First you need to include your ajax-process.php in the plugins main file e.g: require_once plugin_dir_path(__FILE__) . ‘/ajax-process.php’; Second, you need to register your … Read more

MySQL update text field with ‘

Apparently someplace in the wp_list_table, or maybe someplace else, the escape character \ was inserted before any ‘ . I was able to solve this by adding this line of code just before the $wpdb->update statement. $item[‘RecordedSubdivision’] = str_replace(“\'”, “‘”,$item[‘RecordedSubdivision’]);