Articles of posts

Deleting Custom Post type data using mySQL command

I have around 2000 posts under a custom post type storelocations. Deleting them from WordPress admin takes a lot of time. How to delete all the posts from this custom post type from database using mySQL command. Here is my approach: DELETE FROM ‘wp_posts’ WHERE ‘post_type’ = ‘storelocations’ But I guess the post also have […]

Find the user who initially created the post

I have created the post by user (A), later I changed the user of the post to (B), Now I want to find out who initially created the post i.e. user (A) who originally created it. How can I achieve this?

Is there a way to backdate posts?

Is there a way to backdate posts on WordPress? The reason is that I am migrating content over from another site and want to keep their original publishing dates. Edit The content is being migrated manually from a non-wordpress website

How can I allow editors to leave comments on posts that have not yet been published?

On my NFL football blog all users are allowed to make blog posts. New registrants are given contributor status. When users make a post it is reviewed by an editor, then the editor schedules the post to publish at a time fitting our blog schedule. Multiple editors have asked me if they could make a […]

Get post id in wordpress action?

I have this code add_action( ‘delete_post’, ‘my_delete_function’ ); function my_delete_function() { global $wpdb; $wpdb->query(” DELETE FROM wp_votes WHERE post=”.$thePostID.” ;); } How can I get the id of the post being deleted? Additionally, will this still work if multiple posts are deleted in the admin?

How can I get a list of latest posts outside of my WP install?

I have a site with WP installed at /blog, and I’d like to just get a list of the latest blog posts to display on the site home page… that is to say, my custom (PHP) home page, NOT a WordPress page. I found this, but it doesn’t work– the latest version of WordPress is […]

How to get only text from wordpress post content?

I have been using wordpress for my projects. For my homepage of the site I need to display limited text from the post content and the content contains images as well. To display the 100 text i have used substr function of php. What happens here is that the text as well as image is […]

Elegant way to include only published posts with get_objects_in_term()?

The obvious way is to iterate through the resulting array of IDs, get_post for each and test against post_status == ‘publish’. But I wonder whether this could cause memory issues since get_post will attempt by default to cache each result? Short of a custom SQL join, are there any surprise args one can pass to […]

How to make search for the custom post type?

i tried to figure this out but i can’t until know i have new custom post type of questions and i have other post types also like job listing, resumes etc what i want here to make search for the post type questions only here what i done <?php global $app_abbr, $header_search; $header_search = true; […]

WP_Query: offset ignored when posts_per_page is -1?

Is it only me or this is what’s happening? I just want to get all posts starting from a certain offset, like 10. Instead I get all posts starting from the 0.