You need to add your function in the template_redirect
hook. You need to first wait for wordpress to finish loading pages before you can add your hook to remove wpautop
, otherwise your hook will simply get run over. So your funtion will look like this
function pietergoosen_remove_wpautop() {
if ( is_page ( 'services' ) ) {
remove_filter( 'the_content', 'wpautop' );
remove_filter( 'the_excerpt', 'wpautop' );
}
}
add_action( 'template_redirect', 'pietergoosen_remove_wpautop' );
Related Posts:
- Conditional Statement – check if post has an attachment image
- Trying to use Ternary operators with WP Conditionals
- How to do conditional publishing?
- conditional statement for custom taxonomy
- Add user settings to specific roles
- How to display conditional-content if wp_nav_menu( $args ) retruns something
- Create a new usermeta field for users
- Redirect to a different page through registration, depending on page
- How to Arrange PHP Files to Allow for Multiple Types of Pages?
- Reordering Buddy Press profile navigation [closed]
- Is_front_page inside header.php is always returning true
- Advanced Custom Fields – display label and value only if value entered
- PHP conditional script issue
- How to check if the current page is at a specified path in the URL?
- Add class to DIV depending on page loaded
- Can I set up a hover animation in CSS depending on a PHP conditional?
- Multidimensional Array
- Conditional featured image with youtube thumbnail
- How to make a conditional statement within $output in shortcodes.php?
- Conditionally remove comments and post meta in functions.php
- exclude custom post type from running a function
- include content within conditional statement?
- Show label for value only when value exists, basic php
- Conditional formatting on data fetched from MYSQL
- Find and print first entry from WordPress post in custom excerpt?
- Adding if statement
- Change Login or Logout text based on status
- Jetpack: Display Site Title when no Site Logo
- If else statement based on referral URL
- If Month=Particular month display content [closed]
- Php conditional help needed
- Custom Meta Box If Else Statement
- Hide a nav menu item based on get_user_meta results
- How do I reformat this to add php inside php?
- Not able to see the error [closed]
- Error Warning: Declaration of description_walker::start_el after PHP upgrade [duplicate]
- WordPress Warning: preg_replace(): JIT compilation failed: no more memory
- Append code into wp-config.php
- How to turn off redirection from ‘domain.com/login’ to ‘domain.com/wp-login.php’
- Filter link to existing content suggestion
- How to strip non-alphanumeric characters, convert spaces to dashes, uppercase to lowercase in this context
- How to return multiples lines in a shortcode?
- wp_enqueue_style with style.php and WordPress functions
- fallback image for featured image
- Add attribute / custom attribute to product in woocommerce
- Access/update database with jQuery
- How to create another version of my site based on the same database
- How to get bool with `get_option()` when already registered setting with type `boolean`
- Why is this Ajax not working?
- Count the number of times the search form template gets included on a page
- Displaying theme options in css
- Calling directories to load in wordpress
- WordPress – Display array data of a child
- Use DOMDocument with ob_start breaks my HTML code
- How to only enqueue script if it’s a post
- get widget number from array dynamically
- How to auto fetch customer details in Woocommerce in checkout page
- Catchable fatal error: Object of class stdClass could not be converted to string after WP 4.7
- Add class to group inner container
- Illegal string offset in PHP function
- Search WordPress using static html page
- Displaying text if post was within 5 hours
- WP_OPTIONS table, active_plugins entry [closed]
- Verify if a category is the child of another category
- AJAX wp_insert_user WORKS but responds with “The site is not enabled”
- How to get category name or ID by post?
- ACF Repeater Pagination stopped working since upgrade to php7.2
- Using featured image of blog archive page
- Highlight the links without using dropdown
- Automatically Add Page Links to Nav Menu
- Dividing the loop to style post differently
- add button to specific post
- Why, when moving a WordPress multisite network, have my theme customisations stopped working?
- Where should I copy a PHP file from wp-includes to, in order to override it in my child theme?
- How to edit wordpress pages through cpanel? [closed]
- How to get movies by date
- How to change the author box selection on a post to a custom taxonomy
- How to send a php var to jQuery Ajax call with two different file
- not outputting medium size image URL
- WordPress recent post
- Download Featured Image Link in Post Shortcode
- Show subcategory name selected in specific category woocoommerce
- Posts Per Page with a button to add more Posts
- Add custom attribute to product’s HTML to woocommerce cart page
- Change WooCommerce template for PDF – access to custom field
- Detect what link user clicks and Redirect to a specific page for logged in users only
- Decoding an array in PHP (from the Shopify API) [closed]
- Advanced WordPress SQL Query
- Editing existing pre-created menus in PHP
- Showing all post from all post type in admin backstage
- Or operators in PHP [closed]
- how to iterate through xml data?
- Adding slides to an existing carousel manually
- Shortcode to include PHP file, pass various parameters to include?
- What does this if-statement do?: if($pages=’ ‘) {}
- Really slow WordPress site [closed]
- $post->ID calls for current page, but what is the code to call for any new page created and published in WordPress?
- How to increase excerpt length in wordpress? [duplicate]
- Are WordPress & PHP objectively and based on evidence going to die because the future is made of frontend rendering instead of server side rendering? [closed]
- How to conditionally concatenate and translate two very long strings?