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>

Related Posts by Multiple Tags?

I had the same idea and wrote a small little plugin to help me do this. function get_pew_related_data($args, $post_id, $related_id) { global $post, $wpdb; $post_id = intval( $post_id ); if( !$post_id && $post->ID ) { $post_id = $post->ID; } if( !$post_id ) { return false; } $defaults = array( ‘taxonomy’ => ‘topics’, ‘post_type’ => array(‘post’), … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)