How to modify post content?

You might check out the content_edit_pre filter. Your example would then look like this: function wpse89725_pre_edit_content( $content, $post_id ) { $content = “nothing”; return $content; } add_filter( ‘content_edit_pre’, ‘wpse89725_pre_edit_content’, 10, 2 ); You can read more about this filter in the Codex: https://codex.wordpress.org/Plugin_API/Filter_Reference/content_edit_pre Edit: You can also try the edit_post_content filter: add_filter( ‘edit_post_content’, ‘my_pre_edit_content’, 10, … Read more

Merging two wp_posts tables while avoiding duplicates

Import the new table as wp_posts_2, then join them and delete all duplicates based on post_content; then merge the two tables. The following SQL query (untested!) should give the posts from the new table to be deleted: SELECT wp2.* FROM wp_posts_2 as wp2 LEFT JOIN wp_posts as wp ON wp2.post_content = wp.post_content WHERE wp2.post_content = … Read more

Extracting post categories

WordPress has a table called *wp_term_relationships* to keep track of several types of relationships, including post – category. Let’s go table by table: wp_posts – holds all posts,pages, and other content. You want to poll all rows that have -> post_type = post . You might want to poll only published posts -> post_status = … Read more

Use mulitple usernames?

WordPress does not allow this “configuration”. And I seriously doubt you would have any luck writing a plugin that would take care of this in a complete way. The WPDB class is heavily utilized throughout the site, and sifting through read-only vs write-enabled uses would be daunting.

Displaying BLOB PDF File

That looks like it is a template file. If so, the function add_header_info is hooked into send_headers long after send_headers had fired. You will need to move that code so that it executes earlier. It should work from a mu-plugin file, a plugin file or from your theme’s functions.php. However, $FileType and those other variables … Read more