Your code doesn’t seem to be trying to hide the content, but you can use the_content
filter to return an empty content if you are on a specific post page. For example:
add_filter('the_content', 'hide_post_contents');
function hide_post_contents( $content ) {
if( is_single(3) ) {
return '';
}
return $content;
}
Also, there is a mistype in your code. funcion
must be changed to function
.
Related Posts:
- How to add an admin notice upon post save/update
- Passing current cookies in wp_remote_get to get Draft Post Preview
- Listen to Post action
- Manipulate post category after time
- WooCommerce – Create Products Programatically [closed]
- which action to hook to in order to perform post-publish action
- Cannot access current post’s ID in custom plugin
- Set number of article per number of page
- How to change post status from publish to draft using hook in wordpress?
- prevent showing posts of an specific category in admin posts section
- Using radio button meta data from a custom meta box
- How to store an extra (surrogate) ID when creating a post with wp_insert_post?
- Global $post not working in OOP function WordPress
- Define a wordpress constant through plugin functions?
- How to get post bulk edit action trigger and get edited post ids?
- updating a post doesn’t trigger a function
- Hide a specific category in admin All Posts page (WordPress)
- Prevent Delete Attachment by URL or When Submit
- What hook do you use to update a post?
- Updating post data on save (save_post vs wp_insert_post_data)
- What happens if I delete all the rows that represents a post revision from the posts table into WordPress database?
- Filter Hook for post table (not columns)
- why str_replace targeting pages instead just targeting post?
- Get author posts count after excluding a category
- Stop post submission without losing data?
- Cant’ Grab WordPress Built-in Posts Through Loop
- How can my plugin display a populated new post window
- search content of pages and list in wp-admin
- Finding a post’s slug
- Insert specific information to a posts of a predefined category
- Open a wordpress single post in a lightbox without the header and footer
- WordPress: Develop multiple posts with different data
- How do I change the post title’s link on the posts page?
- Update user meta when post published no working
- Fixing the WP Post Object for Custom Route
- Export Posts with specific custom fields by sql
- Custom plugin to get related posts by category
- Error 404 blog/page/2/
- Onclick open posts displayed in slider in a popup [closed]
- How do I save JS classes being applied to the WP dashboard via custom plugin?
- How to end the excerpt with a sentence rather than a word?
- How to automatically generate a unique random slug
- How does filter the_posts work?
- Publish pending article from front end with a button?
- How can I export WordPress posts’ attachments?
- Restrict the Number of Posts an Author can Publish (over time)?
- How do I convert a mathematical Microsoft Word document to a WordPress blog post?
- Which file displays the date archive?
- Add custom field to category of custom post type
- Change post format using custom field
- Plugin for sortable posts in grid [closed]
- Display Latest Post from all Categories
- WordPress theme ajax have_posts()
- Easy way to delete 70k posts and attached media?
- wp_insert_post works, but the post isn’t visible in the admin post list or front end
- Remove arrows from previous and next link
- XML-RPC and post_date
- wp_tag_cloud() and the_taxonomies() work but not the_tag()
- Split WordPress Latest Posts in Multiple Columns and Rows with one single loop [closed]
- How to display data in archive page?
- Drag posts and pages so you can sort them in order
- Category Foreach keeps looping?
- CPT archive redirects to single post
- Archiving by academic year instead of calendar year
- Posts will not display on page-mypage.php
- display a random post thumbnail from a random category
- Display News Posts by Day with Post Counter
- Duplicate Custom Post Type and Taxonomy Slug
- How we exclude current post form related posts
- Remove Content after
- Replace image name on upload to the new post name on front-end form
- Need to change all links in page content but not in post content
- linking to post outside the loop
- wordpress post not showing my “” text>?
- Sort All Posts by Category Name in the Admin Panel?
- Help with listing current users submitted custom post type in template file
- Trying to query all posts in category 4
- How to create several Post pages
- How to show next/prev link, when it’s not active?
- Can I restore restore content from old Worpress site to a new Worpress site from an archive
- Changing The Default Header POST Title and Description text by category in wordpress
- Display hierarchical categories/sub-categories for a single post only
- Create a post automatically if search result has zero results
- Display Post from Custom Post Type with Shortcode
- Using a meta_value or postdate to to query and orderby
- How to generate an HTML link automatically from URL in a users’ post
- How can I get the last post while on the first post for pagination? As if it were infinite
- problem with admin panel
- Display selected category on post page
- When I click edit on a post, all the content disappear. Does anyone know how to fix this?
- Page updates appear in Preview but not live version?
- How to use in_category?
- Change places custom fields with title field in post wp-admin
- WP_Query based on a custom field result
- Assign custom class to post content images
- clicking on page title
- change page name on page list
- Show Next/Previous without Link
- Hindi content automatically converting to unreadable language?
- I can’t edit my posts