How to add a quicklink to the Posts Admin Published|Scheduled|Trash menu

You can use the views_{screen_id} filter (used here), which filters an array where the keys act as an ID for that ‘view’ and the value is the HTML to be used to display the view (such as ‘All’, ‘Draft’, ‘Trash’ etc.). You can simply add extra links to this array: add_filter( ‘views_edit-post’, ‘wpse_add_my_view’); function wpse_add_my_view($views){ … Read more

wp_insert_post is automatically modifying my post content

The documentation for wp_insert_post() says: wp_insert_post() passes data through sanitize_post(), which itself handles all necessary sanitization and validation (kses, etc.). If we dig through it, we can find the responsible filter as: add_filter(‘content_save_pre’, ‘wp_filter_post_kses’); within the kses_init_filters() function. When the kses is initialized with kses_init() it runs: kses_remove_filters(); if ( ! current_user_can( ‘unfiltered_html’ ) ) … Read more

Change permalinks for post type ‘post’ only

I found the answer here. Remember to pop in there and give it a like. I’ll post it here, for people in a rush. Put this into the functions.php-file: function wp1482371_custom_post_type_args( $args, $post_type ) { if ( $post_type == “post” ) { $args[‘rewrite’] = array( ‘slug’ => ‘blog’ ); } return $args; } add_filter( ‘register_post_type_args’, … Read more

Show WordPress Custom Taxonomy Items Based On a Selected Item From Another Custom Taxonomy

Why not make the towns child terms of each state? The taxonomy could be location: See MikeSchinkel’s detailed q and a regarding hierarchal taxonomies. A more elegant solution than refreshing the page upon state selected would be to load the “thetown” child terms using ajax and the get_term_children function or the custom $wpdb query outlined … Read more

Listen to Post action

This is more of a JavaScript the A WordPress Question but anyway, You can use the JavaScript onbeforeunload event something like: <script type=”text/javascript”> old = window.onbeforeunload; window.onbeforeunload = MyOnExit; function MyOnExit(){ //do your stuff here return old(); } </script>