WP Cron emails not working

This should be a comment, but I don’t have comment privelages 🙁 I had this exact problem not long ago, and felt stupid when I realised it was because I had set a password on the directory…

How to get site URL if database is disconnected?

One option is setting the site’s URL in the wp-config.php file itself. This effectively overrides the siteurl option that’s otherwise stored in the database, but it also means you can reference the URL without doing a query. From the Codex: It is possible to set the site URL manually in the wp-config.php file. Add these … Read more

Listing registered scripts

There’s a global variable called $wp_scripts which is an instance of the WP_Scripts class. It doesn’t have a public API for looking at registered or enqueued scripts, but you can look inside the object and see what’s going on. You can see all the registered scripts with: global $wp_scripts; var_dump( $wp_scripts->registered ); To see the … Read more

How to remove/hide action links cluttering under specific plugins’ names

You have the right approach. You will want to use the admin_enqueue_scripts hook: add_action( ‘admin_enqueue_scripts’, ‘wpse_239302_hide_action_links’ ); function wpse_239302_hide_action_links() { global $pagenow; if ( $pagenow == ‘plugins.php’ ) { ?> <style type=”text/css”> .visible .proupgrade, .visible .docs, .visible .forum, .visible .jetpack-home, .visible .support { display: none; } </style> <?php } }

Identify which loop you are hooking into; primary or secondary?

Just a quick update that a new method is_main_query() has been introduced in WP 3.3. Example: add_action( ‘pre_get_posts’, ‘foo_modify_query_exclude_category’ ); function foo_modify_query_exclude_category( $query ) { if ( $query->is_main_query() && ! $query->get( ‘cat’ ) ) $query->set( ‘cat’, ‘-5’ ); } Resources: WPDevel: New API in 3.3: is_main_query() Codex reference: is_main_query() Related Trac Ticket #18677

How to var_dump nav menu items from anywhere?

The items are set up in wp_nav_menu(). There is a useful filter you can use: ‘wp_nav_menu_objects’. It offers the items as $sorted_menu_items and the arguments of the wp_nav_menu() call as $args. From wp-includes/nav-menu-template.php::wp_nav_menu(): $sorted_menu_items = apply_filters( ‘wp_nav_menu_objects’, $sorted_menu_items, $args ); So … hook into this filter, store the data somewhere, return the $sorted_menu_items unchanged and … Read more

How can I determine what php files are being called by a given WP page?

There’s a native PHP function get_included_files() for that. Simply attach it to an action on the hook from where you want to know it. The first one is muplugins_loaded and the last accessible on is shutdown. add_action( ‘muplugins_loaded’, function() { $files = get_included_files(); foreach ( $files as $f ) echo $f.'<br>’; // or… var_dump( $files … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)