Reapproval for edits and deletion after post is published

Let us solve this by going with your second option. So you want to restrict users from editing published posts, this can be done by adding this to your theme’s functions.php file (please read the comments that is added): function restrict_editing_old_posts( $allcaps, $cap, $args ) { // Restrict users from editing post based on the … Read more

Hiding posts and pages in panel

The code you posted doesn’t work because there is no global $currentpage. There are $current_screen and $pagenow. add_action( ‘pre_get_posts’, ‘wpse_63414_hide_pages’ ); function wpse_63414_hide_pages( $query ) { if( !is_admin() ) return $query; global $pagenow; $pages = array(‘2′,’26’); if( ‘edit.php’ == $pagenow && ( get_query_var(‘post_type’) && ‘page’ == get_query_var(‘post_type’) ) ) $query->set( ‘post__not_in’, $pages ); return $query; … Read more

Save metabox checkboxes values to custom content type

I have rethought the problem: Finally, I resolve it with save_post hook: function enhanced_portfolio_categories_save_post(){ $terminos = array(); foreach ($_POST[‘my_categories’] as $key) { $custom_tax = get_term_by(‘term_id’, $key, ‘portfolio_categories’); array_push($terminos, $custom_tax->term_id); } wp_set_object_terms( $_POST[‘post_ID’], $terminos, ‘portfolio_categories’); }

Filter/Remove HTML Elements on all posts and pages

Here’s an example function that might help you accomplish something like that. Basically what it does is fetch a couple of posts, loops through them, modifies the post_content field and stores the changes. function wpse_87695_clean_post_content() { $posts = get_posts(array( ‘post_type’ => array(‘post’, ‘page’), ‘post_status’ => ‘publish’, /* ‘meta_query’ => array( array( ‘key’ => ‘_wpse_87695_processed’, ‘value’ … Read more

Hide parts of the post content on the home page

If your video is pasted into the post body, you have a couple of options. Use a filter on the_content and preg_replace to remove the content. Wrap your content in a shortcode. I am going to recommend option #2 because option #1 involves processing markup with regex which is tricky and prone to error, and … Read more

Inserting ads within content

Have faith 😉 Unfortunately, your code ain’t correct in multiple ways. It assumes that the content only consists of content enclosed by paragraphs and doesn’t work correctly if not. This would be one solution: add_filter(‘the_content’, ‘prefix_insert_post_ads’); /** * Content Filter */ function prefix_insert_post_ads($content) { $insertion = ‘Your AD Code’; if (is_single() && ! is_admin()) { … Read more