wp-cron event doesn’t run when custom login API is enabled
wp-cron event doesn’t run when custom login API is enabled
wp-cron event doesn’t run when custom login API is enabled
It’s hard to answer that without some additional code to accompany it as those aren’t WordPress core functions and could be doing anything really. Based on a previous question, I’ll assume one of the plugins you’re referring to is the LiquidChurch/lqd-messages plugin and I see those methods in the main plugin file. Even if this … Read more
Misleading behaviour on Menu & Theme location
So after consulting on Facebook Advanced WordPress group, the advice was to create an object with setters and getters instead of using the declaring and getting variables in the global scope as shown in the code below: class MyPlugin { public $current_post_types; public function __construct() { add_filter(‘init’, array($this, ‘get_variables’)); } public function get_variables() { $this->current_post_types … Read more
You can use user_register action, which is invoked after registering a new user. To add or remove roles/caps, the WP_User class provides methods: add_cap(), add_role() remove_cap(), remove_role() Your code might look like this: add_action( ‘user_register’, ‘se385135_user_register’ ); function se385135_user_register( $user_id ) { $user = wp_get_current_user(); if ( !isset( $user->ID ) || $user->ID == 0 ) … Read more
You can add the action on the init itself, just increase the priority of the add_action call. The higher the priority the later the function is called. add_action(‘init’, ‘retrieve_my_terms’, 9999); But my suggestion is that you should do these kind of things as late as possible, preferably just before the first time they are used. … Read more
Session management issues with WordPRess 404 Error page
pre_get_posts doesn’t just run on the frontend, it runs on all post queries, and that includes RSS feeds, XMLRPC, AJAX, REST API, and WP Admin. You need to check in your pre_get_posts filter and exit early so that it only applies to the places you want it to apply to. e.g. if ( is_admin() ) … Read more
Why not output your Theme’s custom Widgets using the_widget(), inside of a if ( ! dynamic_sidebar( ‘sidebar-name’ ) ) conditional? e.g. <?php if ( !dynamic_sidebar( ‘sidebar-right’ ) ) { $widgetsidebarrightargs = array( ‘before_widget’ => ‘<div class=”widget”>’, ‘after_widget’ => ‘</div>’, ‘before_title’ => ‘<div class=”title widgettitle”>’, ‘after_title’ => ‘</div>’ ); the_widget(‘WP_Widget_Calendar’ , ‘title=” , $widgetsidebarrightargs ); the_widget( … Read more
You do it like in your first example // Shortcodes.php file function myplugin_shortcode( $atts ) { if ( !empty ($atts) ) { foreach ( $atts as $key => &$val ) { $val = html_entity_decode($val); } } myplugin_display_items( $atts ); } // Register shortcodes add_shortcode( ‘output-items’, ‘myplugin_shortcode’);