WordPress admin area not sending mail (but works with WP Mail SMTP, Test Mail, and PHP mail() function)

I found the issue, had to edit /etc/php/8.3/cli/php.ini file, by adding/editing following lines : [mail function] ; For Win32 only. ; https://php.net/smtp #SMTP = localhost SMTP = mysmtpserver.domain ; https://php.net/smtp-port smtp_port = 25 username = myusername password = mypassword sendmail_from = [email protected] Then a service nginx restart. I still don’t understand why PHP is able … Read more

Automatically populating a date parameter within a shortcode

you can generate shortcodes and launch them with this function : https://developer.wordpress.org/reference/functions/do_shortcode/ so you can do that in your plugin : add_shortcode(“MY_PLUGIN__forms_with_dates”, function ($atts, $content, $tag) { $atts = shortcode_atts([ “months” => 11, “id_form” => NULL, ], $atts, $tag); if (!isset($atts[“id_form”])) { return “shortcode $tag : the argument id_form is missing.”; } $shortcodes = “”; … Read more

WordPress per ACF – permalink is not working

get_the_permalink() returns the permalink as a string and doesn’t echo it. You either need to echo this yourself <?php echo get_the_permalink(); ?> as you’ve got in some of your other <?php tags, or you can use the helper function the_permalink() which does echo <?php the_permalink(); ?> the same pattern as you’ve used for the_title(). Note … Read more

Add Imports to Existing WordPress Import Map

Turns out to be quite simple in WordPress 6.5. Use wp_register_script_module to register the imports, and include them as dependencies in wp_enqueue_script_module: add_action(‘wp_enqueue_scripts’, ‘enqueue_three_d_script’); function enqueue_three_d_script() { wp_register_script_module( ‘three’, “https://unpkg.com/[email protected]/build/three.module.js”, array(), null ); wp_register_script_module( ‘three/addons/’, “https://unpkg.com/[email protected]/examples/jsm/”, array(), null ); wp_enqueue_script_module( ‘three-d-script’, SCRIPTS_DIR . ‘threeDTest.js’, array(‘three’, ‘three/addons/’), null ); }

How to Customize the Admin Sidebar Menu in WordPress Multisite Network by changing the backend code of the wp-admin code files?

Firstly, you should absolutely not modify core files. Ever. Any changes you make to core files can and will be overwritten any time WordPress updates. There are umpteen ways in which WP has been written to allow you to change its behaviour without hacking on core files: hooks, filters, APIs. Use those instead. In this … Read more

Add up all numbers from a WordPress query [closed]

.= does string concatention, eg, ‘hello ‘ . ‘world’ gets you hello world. To add, use + instead of .: // Set a default for $numbers. $numbers = 0; $query = new WP_Query($args); if ($query->have_posts()) { while ($query->have_posts()) { $query->the_post(); $post_id = get_the_ID(); $party_size = get_field(‘reservation_party_size’, $post_id); $numbers += intval( $party_size ); } } return … Read more

error code: 523