An echo line in a transition_post_status action leads to “cannot modify header information – headers already sent by”

The error message you are seeing is normal for that operation. By the time the transition_post_status hook fires, the HTTP page headers is already sent. By simply echoing an error message inside a hook like transition_post_status which was never intended to echo any output to the browser, as you did, you are actually trying to … Read more

Modify users.php page to create page/post on button clicked

Use wp-admin/admin.php with an action parameter: <a href=”https://wordpress.stackexchange.com/questions/184153/<?php echo esc_url( admin_url(“admin.php?action=wpse_184153_create_page&user_id=$user_id” ) ) ?>”>Create Page</a> And then hook onto the event: function wpse_184153_create_page() { $redirect = admin_url( ‘users.php’ ); if ( ! empty( $_GET[‘user_id’] ) && $user = get_userdata( ( int ) $_GET[‘user_id’] ) ) { // Create your page // Add any URL parameters … Read more

Adding functions to hooks from within a class

I created a class instance and referenced that in add_action, which is moved below where the instance is created: if ( ! function_exists(‘add_action’) ) { header(‘Status: 403 Forbidden’); header(‘HTTP/1.1 403 Forbidden’); } if ( ! class_exists(‘My_Authentication’) ) { class My_Authentication { public function setup() { add_action(‘wp_login’, array(&$this, ‘no_auth_allowed’) ); add_action(‘wp_logout’, array(&$this, ‘no_auth_allowed’) ); } public … Read more

Add a row on clicking each post featured image

If you go with @Rituparna’s solution, try this: Don’t forget to add <a href=”#” class=”close”>X</a> in your container. jQuery(function($){ $(“.plink”).on(‘click’, function( event ){ event.preventDefault(); // cache the link clicked on var link = $(event.target); // use the link attr to target the desc var containerID = link.attr(‘href’); // get the description contained in the link … Read more