‘random_password’ filters not taking effect

I think, your PHP syntax is wrong. Try these, function wpgenerapass_generate_password( $password, $length, $special_chars, $extra_special_chars ) { $chars=”abcdefghijklmnopqrstuvwxyz”; $chars .= ‘ABCDEFGHIJKLMNOPQRSTUVWXYZ’; $chars .= ‘0123456789’; $chars .= ‘!@#$%^&*()’; if ( $extra_special_chars ) { $chars .= ‘-_ []{}<>~`+=,.;:/?|’; } $wpgenerapass_password = ”; // Initialize the password string $password_length = 8; for ( $i = 0; $i < … Read more

WordPress REST API won’t allow me to filter by author ID when called internally, works externally in Postman

My approach to this was wrong, and I didn’t understand the error properly. After taking another look at this, I was able to fix it by replacing this code: if($request->get_param(‘id’)){ // $author = $request->get_param(‘author’); $podcastsRequest = new WP_REST_Request( ‘GET’, ‘/wp/v2/podcasts?author=1’); $articlesRequest = new WP_REST_Request( ‘GET’, ‘/wp/v2/articles?author=1’); $webinarsRequest = new WP_REST_Request( ‘GET’, ‘/wp/v2/webinars?author=1’); $expertInterviewsRequest = new … Read more

theme.json should be in the child theme folder when using xxxx.json style located in the styles folder?

Short answer: No Long answer: The child themes theme.json will simply use the TT3 theme.json values if a specific value is not found. So you can make a new theme.json file only with the specific values needed for the child theme. An excellent writeup is available here: https://kinsta.com/blog/twenty-twenty-two-theme/#extending-twenty-twentytwo-with-a-child-theme

Is there any performance difference between duplicating composer packages among multiple plugins and not doing it? How can I avoid it?

There are no performance issues with duplicating composer packages. If you look at the file vendor/composer/autoload_classmap.php, you will see lines like these: <?php // autoload_classmap.php @generated by Composer $vendorDir = dirname(__DIR__); $baseDir = dirname($vendorDir); return array( ‘Attribute’ => $vendorDir . ‘/symfony/polyfill-php80/Resources/stubs/Attribute.php’, ‘Codeception\\Exception\\ConnectionException’ => $vendorDir . ‘/codeception/module-webdriver/src/Codeception/Exception/ConnectionException.php’, … Being loaded during composer activation, this film establishes … Read more

How can I produce multiple webpages with a different output based on one entry/Page/custom Page?

Query string parameters are a helpful friend in this situation. It will allow you to keep the same single-$posttype.php file for both formats of the page. So if someone visits your page using the URL: https://yourwebsite.com/events They will see your normal webpage for visitors. But if someone uses the URL: https://yourwebsite.com/events?seminar=true They will see something … Read more

How to create a transient that persists the data for the whole duration of the expiration, even when object cache is enabled?

I eventually used a combination of update_option and WP Cron: // Create the option. update_option(‘foo’, ‘bar’, false); /** * Schedule it to be deleted one week from now. * * @param int Expiration timestamp * @param string Hook that will be invoked * @param string Params to send to the hook callback */ wp_schedule_single_event( time() … Read more

What is the standard way to use the version of React that ships with Gutenberg on the front end?

I found it, wp-element. The @wordpress/scripts should handle the heavy lifting of transforming the JSX in the proper way. add_action( ‘wp_enqueue_scripts’, ‘my_enqueue_plugin_js’ ); // Loads on frontend function my_enqueue_plugin_js() { wp_enqueue_script( ‘my-plugin-frontend’, plugin_dir_url( __FILE__ ) . ‘js/plugin.js’, [‘wp-element’] ); } Once we do this we will have window.wp.element available in our JavaScript. This contains the … Read more

Show Admin Menu

add_submenu_page() this function used to add submenu in Admin Menu Page. And You will remove submenu from wordpress admin using remove_submenu_page(). add_submenu_page() by default takes 7 parameters. add_submenu_page( string $parent_slug, string $page_title, string $menu_title, string $capability, string $menu_slug, callable $function = ”, int $position = null ) Write the following code in your functions.php file … Read more

How can I specifically enqueue scripts for edit orders pages only

You can do it by checking current post_type. For woocommerce order page, post type is shop_order. So try to change your code as follows. function selectively_enqueue_admin_script_js_for_edit_address($hook) { global $post; if ($post->post_type === ‘shop_order’) { if ($hook === ‘post.php’ || $hook === ‘post-new.php’) { wp_enqueue_script(‘artio-wc-admin-order-page-mod’, ‘/wp-content/plugins/custom_wc_mods/order_page/paste_payment_instructions_and_prompts_into_shipping_address_form_v2.js’, array(), date(“h:i:s”)); /* https://stackoverflow.com/a/31834007 */ /* During development, you could … Read more