merging an array to an existing array using add_filter

You are overwriting $args in add_yourself_to_some_examplehook(). Based on what you’re saying you want to achieve, you should be appending the new item instead: add_filter( ‘some_example_hook’, ‘add_yourself_to_some_examplehook’ ); function add_yourself_to_some_examplehook($args) { $args[ ‘Hello5’ ] = ‘HELL4’; // <– Note the syntax here. return $args; }

htmlentities and editing text

Do I need to sanitize the data before putting the text back in a text box for edit. You “sanitize” data that you are receiving. Then “escape” it when outputting. Depending on your exact code (which you did not provide any examples of), you may want to do more than stripslashes() (or replace that altogether). … Read more

Error “Call to a member function switch_to_locale() on null” during insert_with_markers

From your comment: Those htaccess changes don’t happen as a result of an add_action. Perhaps they should? Yes, they should. And here’s why insert_with_markers() calls switch_to_locale() which uses $GLOBALS[‘wp_locale_switcher’] (or $wp_locale_switcher) which is initialized in wp-settings.php, but only after WordPress runs the setup_theme hook. And looking at the error in question and line #1582 in … Read more

Create custom blocks for bootstrap

Rather than create new blocks to represent the Bootstrap classes. You should enqueue the bootstrap js and css files in your theme as you say you normally do. Once bootstrap has been added to the theme, you can simply assign the bootstrap css classes to the already existing Gutenberg blocks. As demonstrated in the following … Read more

Self-hosted plugin update problems

Ok, this is a working solution but a hacky one. First, the explanation. After much gnashing of teeth and error logging I’ve discovered that the filter ‘pre_set_site_transient_update_plugins’ is called at least twice during a plugin update check. Sometimes, the passed array has the ‘checked’ array attached to it, sometimes it does not. I have no … Read more

Problem with WordPress Ajax form

Ok, after a lengthy discussion Edegist and I actually sorted this all out. Here’s a couple of the key factors that comprise the solution. One, we had to loop through all of the selected checkboxes to pass via AJAX. jQuery( document ).ready( function( $ ) { $( ‘.kvo_ajax_submit_button’ ).click( function( e ) { e.preventDefault(); var … Read more