Skip to content

Instantly share code, notes, and snippets.

@WerdsWords
WerdsWords / comment_status_links.php
Created August 7, 2013 17:27
#38: comment_status_links
@WerdsWords
WerdsWords / comments_per_page.php
Created August 7, 2013 02:15
#37: comments_per_page
<?php
/**
* Increase comments-per-page limit when viewing spam comments
*
* @see WP_Comments_List_Table::get_per_page(), WP_Screen::render_per_page_options()
*
* @param int $comments_per_page The number of comments to list per page.
* @param string $comment_status The current comment status view. Default is 'all'.
*
* @return int The filtered number of comments to list per page.
@WerdsWords
WerdsWords / heartbeat_send.php
Created August 7, 2013 01:54
#36: heartbeat_send
<?php
// No example yet.
@WerdsWords
WerdsWords / heartbeat_received.php
Created August 7, 2013 01:44
#35: heartbeat_received
<?php
/**
* Example 'Marco, Polo' Heartbeat data received filter.
*
* Based on an original Gist by Jason Coleman (https://gist.github.com/strangerstudios/5888123)
*
* @see wp_ajax_heartbeat()
*
* @param array|object $response The response object.
* @param array $data An array of $_POST data.
@WerdsWords
WerdsWords / type_send_to_editor_url.php
Created August 5, 2013 23:27
#34: $type_send_to_editor_url
<?php
/**
* Add data-type attribute to video links sent to the editor
*
* @param string $html The link HTML sent to the editor.
* @param string $src The media item source URL.
* @param string $title The media item title.
*
* @return string The link embed HTML markup.
*/
@WerdsWords
WerdsWords / media_send_to_editor.php
Last active December 20, 2015 15:19
#33: media_send_to_editor
<?php
/**
* Disallow inserting 'full' sizes images into the editor.
*
* @see wp_ajax_send_attachment_to_editor(), media_upload_form_handler()
*
* @param string $html The unslashed HTML to send to the editor.
* @param in $id The attachment id.
* @param array $attachment An array of attachment attributes.
*
@WerdsWords
WerdsWords / attachment_fields_to_save.php
Last active December 20, 2015 15:19
#32: attachment_fields_to_save
<?php
/**
* Save custom attachment meta
*
* @see wp_ajax_save_attachment_compat(), media_upload_form_handler(), edit_post()
*
* @param array $post The attachment attributes.
* @param array $attachment_data An array of attachment fields.
*
* @return array The attachment attributes.
@WerdsWords
WerdsWords / wp_check_post_lock_window.php
Last active December 20, 2015 14:39
#31: wp_check_post_lock_window
<?php
/**
* Extend post lock interval to 2.5 minutes.
*
* @see wp_ajax_wp_remove_post_lock(), wp_check_post_lock()
*
* @param int $duration The post lock window interval.
*
* @return int The filtered interval.
*/
@WerdsWords
WerdsWords / nav_menu_meta_box_object.php
Created August 4, 2013 01:37
#30: nav_menu_meta_box_object
<?php
/**
* Rename category and tag menus accordion sections.
*
* @see wp_ajax_menu_get_metabox()
*
* @param object $item_object The menu meta box object, e.g. post, page, category, post_tag.
*
* @return object The filtered meta box object.
*/
@WerdsWords
WerdsWords / wp_edit_nav_menu_walker.php
Created August 3, 2013 22:34
#29: wp_edit_nav_menu_walker
<?php
/**
* Use custom Walker class when adding menu items.
*
* @see wp_ajax_add_menu_item()
*
* @param string $class The Walker class name to use. Default is 'Walker_Nav_Menu_Edit'.
* @param int $menu_id The menu id. Uses the value of $_POST['menu'].
*
* @return string The Walker class name.