Custom comment type maybe?

I also (ab?)use comments for “private” replies to posts, like product inquiries, suggestions, answers to contests, … The advantage is that they are stored in the database and displayed in the interface without extra code from me (sometimes I add a filter to improve the formatting). Spam filtering and e-mail notifications are easy extras. I … Read more

Include images from pages in wp search.php results in default wp search

To include the attachment (media) post type in search results, use the following code snippet function attachment_search( $query ) { if ( $query->is_search ) { $query->set( ‘post_type’, array( ‘post’, ‘attachment’ ) ); $query->set( ‘post_status’, array( ‘publish’, ‘inherit’ ) ); } return $query; } add_filter( ‘pre_get_posts’, ‘attachment_search’ ); Source However, this does not take care of … Read more

Plugin for changing a post’s category based on it’s post date?

Don’t know of a plugin but you can use wp_schedule_single_event function. First create a meta box that takes to values: time for removal and what category we want to set it to when removed from featured. /* hook meta box */ add_action(“admin_init”, “admin_init”); /* hook meta box function */ function admin_init(){ add_meta_box(“Featured Removal”, “Featured Removal”, … Read more

Can Not Redirect from Plugin-Registered Admin Page

You can’t redirect to another page, because WordPress has already rendered admin header and sidebar templates. If you really wish to redirect users to another page, you need to do it earlier, before header and sidebar are rendered. You can use action of following structure to redirect to another page: load-{parent_page_slug}_page_{plugin_subpage_slug} The full snippet: define( … Read more

How to select featured images for 1500 posts?

You can run a script that will programmatically set the featured image for each post. You can use the first attached image for this. To get the attached images run a query for the posts and loop through each one and use get_children() setting the post_parent to the current post id in your loop. $posts … Read more