wp-env mysqlcheck error:1130

Step 1: Find the name of your wp-env container First, you need to locate the name of the container created by wp-env. To do this, in the directory of your project containing .wp-env.json, you must run the following command: docker ps This should give you a list of containers. In the Names column, you’ll see … Read more

Adding JavaScript to a WordPress website

Using this link, you will find helpful notes as to how to add a script to your WordPress website. The main idea is to use inbuilt WordPress functions to load your scripts. This is done via the wp_enqueue_script function. Following examples provided in the aforementioned link, you will be able to learn how to enqueue … Read more

How to load plugin after page is loaded – pagespeed issues

I’d reach out directly to that plugin developer to relate your concerns, and if they’re not responsive consider a different plugin. But in the meantime, you can use wp_dequeue_script() and wp_dequeue_style() and their counterparts wp_enqueue_script/style to remove the stuff that’s slowing down your site. This answer has more detail on how to move scripts from … Read more

How to test nonce with AJAX – Plugin development

I see some issues: You ajax action can be only used by logged users. If this is correct, I recommend you add a nopriv action that returns a error message. // Inside Constructor add_action( ‘wp_ajax_nopriv_pp_html_process’, array( $this, ‘pp_html_process_not_logged’ ) ); And create this function : public function pp_html_process_not_logged () { // Status can be used … Read more

Gutenberg add extra attributes to custom format

I was able to add the attribute by passing it in attributes through the registerFormatType settings: attributes: { ‘custom-attr’: ‘custom-attr’ }, then in edit(): toggleFormat( value, { attributes: { ‘custom-attr’: ‘Hello world’ }, } ) I don’t know how exactly it all works together because I could not find detailed explanations in the current documentation. … Read more

How to use div -ids in url to jump to specific post…Is trailing slash the culprit?

First, I’d recommend using “pretty permalinks” over the default query-string structure. This will eliminate most of your problems from the getgo. It will turn your http://www.example.com/?cat=15#post-170 urls into http://www.example.com/category/category-slug/#post-170 and the browser will move correctly to the post’s position in the page. That said … Yes, you can remove the trailing slash. The trick is … Read more

add JS to multiple plugin admin pages

It would be easiest to run some conditional logic on $parent_file inside a callback hooked onto admin_print_scripts, and would go a little something like this.. add_action( ‘admin_print_scripts’, ‘possibly_enqueue_script’ ); function possibly_enqueue_script() { global $parent_file; if( ‘my-slug’ == $parent_file ) wp_enqueue_script( … your enqueue args .. ); } You’ll need to replace my-slug with the handle … Read more