Login cookies blocked after customizing hashing method

This line (at least) is being output before the cookie can be set: echo ‘<h2>’.$hash.'</h2>’; Sending output to the screen (even empty lines) will prevent cookies being set. From the PHP docs: Like other headers, cookies must be sent before any output from your script (this is a protocol restriction). This requires that you place … Read more

Create custom WP_List_Table in post_type

You can use the pre_get_posts filter to modify requested posts, this filter works in the admin area too, so you don’t need to go to the trouble of creating a new post list table class First lets add a query var to the URL of your ‘My Cases’ page: function register_adminMenu(){ add_submenu_page(‘edit.php?post_type=case&mycases=mine’, ‘My Cases’, ‘My … Read more

How WordPress core manage the plugin installation

WP unzips the .zip file and places its contents inside of /wp-content/plugins/. From there, WP is set up to recognize plugins inside that folder with a specific comment: <?php /* Plugin Name: Example Plugin */ The plugin can either be a single PHP file directly inside /wp-content/plugins/ or be a full subfolder such as /wp-content/plugins/example-plugin/ … Read more

How can I reference external attachments without breaking core WordPress files?

Pay attention to the comments along the snippet. <?php /** * Filters the attachment URL. * * @param string $url URL for the given attachment. * @param int $att_id Attachment post ID. * * @return string $url Custom URL for the given attachment. */ function wp_get_attachment_url_callback( $url, $att_id ) { // Instead of keeping full … Read more