Pull posts from another wordpress install on same server

if it’s the same database, you can write the query easily using the global $wpdb variable. If it’s a separate database, create another instance of wordpress wpdb class & write the queries to it $wpdb2 = new wpdb( $user, $pass, $db, $host ); In any case, you’ll need to know the database tables prefix UPDATE … Read more

How to intercept Post Title on Post-Save

To set the title before it is saved, hook into wp_insert_post_data: add_filter( ‘wp_insert_post_data’, ‘wpse_75597_change_title’ ); function wpse_75597_change_title( $post_data ) { $post_data[‘post_title’] = ‘SOMETHING VERY LOUD’; return $post_data; }

Load posts into sidebar and paginate via ajax?

You need to wrap the nonce with quotes and instead of the_permalink() and the_title() use get_permalink() and get_the_title() so like this: <?php $args = array(‘posts_per_page’ => 1); $sidebar = new WP_Query($args); if ( $sidebar->have_posts() ) : while ( $sidebar->have_posts() ) : $sidebar->the_post(); ?> <div class=”story”> <a href=”https://wordpress.stackexchange.com/questions/76921/<?php the_permalink(); ?>” title=”<?php the_title(); ?>”><?php the_title(); ?></a> </div> … Read more

Side by side blog posts that are tied together

A very simple solution: Add a second editor field to the post editor, and use the meta field content in a filter on the_content. add_filter( ‘the_content’, ‘wpse_77811_extra_content’ ); function wpse_77811_extra_content( $content ) { return $content . get_post_meta($post->ID, ‘_t5_extra_box’, TRUE ); }

How can I hook into creating a new post and execute wp_die(), before the post is inserted into the database?

Try filtering with wp_insert_post_data instead. It’s from wp-includes/post.php, line 2864. add_filter( ‘wp_insert_post_data’, ‘post_publish_filter_wpse_82356’ ); function post_publish_filter_wpse_82356( $data ) { // view/manipulate $data if (‘publish’ == $data[‘post_status’]) { $msg = ‘<pre>’ . var_export($data, true) . ‘</pre>’; wp_die($msg); } return $data; } publish is the post_status when you click the Publish or Update button. The four statuses … Read more

How do I allow users to follow a post and then allow admins to email all users who have followed that post?

I don’t think its polite to send email to all users who Favorited your post. Because some people favorite your post to bookmark it. So don’t combine favorite with follow. So here is my suggestion: For bookmarking, use WP favorite posts plugin. As for the follow there is no plugin exists for normal wordpress installation. … Read more

Require a featured image to publish post

You can do something like this with the hook pre_post_update : function wpse_108013_mandatory_featured_image() { if(!has_post_thumbnail()) { // here you check if there’s a featured image wp_die( ‘Featured image must always be set !’ ); // there is no featured image } } add_action( ‘pre_post_update’, ‘wpse_108013_mandatory_featured_image’ );

Limit number of posts a user can make per minute?

I would begin with establishing the most friendly approach to this. I think it would be a warning after post Publish/Update button is clicked. It is possible to prevent the Edit Post screen loading if the user re-visits it within 2 minutes after the previous post is published. I don’t think that is practical though … Read more