duplicate posts when trying to update a post using the wp_insert_post.
You should insert posts with wp_insert_post and update posts with wp_update_post. wp_update_post will add a revision to the database and update the published/draft post data.
You should insert posts with wp_insert_post and update posts with wp_update_post. wp_update_post will add a revision to the database and update the published/draft post data.
There are two hooks named ‘pre_post_link’ and ‘post_link’. Their first argument – which you can change – is the permalink. So … add_filter( ‘pre_post_link’, ‘wpse_42406_change_permalink’, 10, 2 ); function wpse_42406_change_permalink( $permalink, $post ) { // change the permalink, let it point to an archive etc. return $permalink; } … will change the output. In your … Read more
Here is an idea but before we go into details, here are VERY VERY IMPORTANT notes NOTE: READ THIS FIRST Take a database back up before running this code. It is advisable to run this on a local install first for testing purposes. Note on wp_trash_post(), from the codex If trash is disabled, the post … Read more
add below code after echo $attach_id…. set_post_thumbnail( $post_id , $attach_id);
you can use global $current_user; get_currentuserinfo(); and then add ‘post_author’ => $current_user->ID to your $new_post array. then you can use <p>Posted by: <?php the_author(); ?></p>
By default images already have unique class’s but this depends on your theme. Use firebug and hover over the images and you should see stuff like class=”aligncenter size-full wp-image-1525″. If you want to change the class or id or alter any attributes of the image you can use the get_image_tag filter. For example, add_filter(‘get_image_tag_class’,’my_custom_class’); function … Read more
Show Custom Taxonomy Categories, Listing of Posts, and Single Post via AJAX
Just guessing here, but I suspect that query_posts() is not appropriate in this situation. query_posts() should only be used to modify the main query, and the emerging best practice is that query_posts() shouldn’t be used at all, but, instead, replaced by filtering pre_get_posts. Having said all that, I would look into WP_Query and particularly the … Read more
First of all in your image you can see that WordPress lets you filter the posts by category, just bellow the what you have added to the image, But if you want to know how you can add your own link to the filter you can use the views_edit-post filter hook ex: add_action(‘pre_get_posts’, ‘query_add_filter’ ); … Read more
<meta property=”og:image” content=”http://alexchen.info/taiwantalk/wp-content/uploads/2011/03/cheating.png” /> Visit http://developers.facebook.com/docs/reference/plugins/like/ and see “Step 2 – Get Open Graph Tags” There’s also a lot of WP plugins out there that can help you to generate Open Graph tags.