Too few arguments – wp_login action

The custom role needs the read capability to view the backend. Example: $your_role = get_role(‘your_custom_role’); $your_role->add_cap( ‘read’ ); See: https://wordpress.org/documentation/article/roles-and-capabilities/#read Ideally, this should only be done once, e.g. when activating your plugin or theme.

Function attached to cron job not running but will run if called manually

It looks like the time() was not set correctly in the first iteration of the function wp_schedule_event; First, remove this task from the queue by adding a function wp_clear_scheduled_hook and reload the page. For your example: wp_clear_scheduled_hook( ‘opportunities_cron_job’ ); Remove the cleaning function. Restart your code. If your date is not set correctly again, use … Read more

Execute wp_after_insert_post after the permalink is customized

To execute update_post_meta after the permalink is customized, you can use the save_post hook instead of wp_after_insert_post. Here’s how you can modify your code: add_action(‘save_post’, ‘add_permalink_to_new_post’, 10, 2); function add_permalink_to_new_post($post_id, $post) { // Check if this is a new post if ($post->post_date_gmt == $post->post_modified_gmt) { // Only run this on a newly created post update_post_meta($post_id, … Read more

How to change content hash value, within the_block_template_skip_link action?

If remove_action( ‘wp_footer’, ‘the_block_template_skip_link’ ) did not work, then try with remove_action( ‘wp_enqueue_scripts’, ‘wp_enqueue_block_template_skip_link’ );, or both of that. (see source on GitHub) As for changing the href value, I’m not aware of any (filter) hook to do that, but you can either edit your template and set the <main>‘s id value to content-top, or … Read more

Is there a hook that I can use when a fatal error occurs?

Look into the WP_Fatal_Error_Handler class. I see a couple of filters in its display_default_error_template() method that might be helpful for you: wp_php_error_args wp_php_error_message The entire class is a drop-in, so if you need to you can replace it entirely with your own version, but I think one of those filters—probably wp_php_error_args—might be what you’re looking … Read more