Using is_page()
inside functions.php is fine, possible and working, and if you are echoing is_page(15)
and getting true, that means you are on a page with the ID of 15.
the problem could be the priority parameter of the add_filter call, form the codex:
Make sure to set the priority
correctly, else the default WordPress
filter on this function will run last
and override what you set here.
so change your code to :
add_filter ( 'excerpt_length', 'custom_excerpt_length',999);
Related Posts:
- Define page template in wp_insert_post
- Add custom template page programmatically
- Define custom Page Template without its own .php file
- Filter the query ONLY for the search results page
- Check if the user has explicitly set an excerpt
- How to override function in functions.php of parent theme?
- Show Video in Excerpt
- When is wp_trim_excerpt() called?
- Stripping shortcode from custom excerpt function
- Remove images from get_the_excerpt
- display public excerpt for private post
- get_the_excerpt() not returning anything when post has no excerpt
- get excerpt without images
- Run Product Filter Javascript On Page Template
- Allow latex in wordpress excerpt
- Programmatically set page template based on page ID
- How to make unique add_filter to the_content of specific page template files – so each template gets its own addition
- Custom excerpt legnths for specific pages
- Adjust which tempalte a page uses with a function?
- How to specify which Gutenberg blocks are available in the editor for a page template
- how to change link of some wordpress pages
- Filtering posts by category name based on page’s slug
- How to filter out shortcode when displaying the_excerpt() in the loop?
- Using “Read More” link with custom excerpt
- is_account_page() change to page slug
- How to enable template page only for a post id page
- How to display post content instead of excerpt
- Activate small php condition at footer over page template
- Get_template_part inside a folder
- Using Schema with `the_excerpt`
- Custom Post excerpt not working correctly
- Limit length of first excerpt in the loop
- new_excerpt_more link not working properly
- Excerpts are not displayed by a shortcode on category pages
- Pass parameter to hooked function using custom page template
- different style sheet for just one page template
- How to display retweet count and likes in the meta above the excerpt
- Setting a default text for excerpts of a particular category
- Remove links from the_content when using filters wp_trim_excerpt
- Excerpt for pages not showing
- How do I pull excerpts from pages?
- WordPress Excerpt – How to remove the first link using functions.php
- Strip div From Excerpt
- How to change value of variable in theme file with functions.php WordPress?
- first paragraph of the_content as meta description
- Adding Read More to Custom excerpts
- Page Template Won’t Load Correct CSS File
- Limit number of characters in different excerpts
- Function to check if custom page is used by page?
- Unable to use get_page_by_title() more than once per page?
- the_excerpt function not showing image
- How to Override Page Template if URL matches query?
- Probleme shortcode with list author
- How Can I Create a Friendly Slug for a Dynamic Page?
- Enqueue script if not page template
- Appending „read more” to the excerpt conditionally
- Pagination won’t work on custom page
- Hide disclaimer from summary excerpts
- Edit meta fields from within template
- How to make an If Else on Excerpt Filter
- Sending Messages Back to the Template After Processing?
- is_page_template wont allow me to enqueue scripts
- getExcerpt: Make ellipsis appear only if character limit is reached
- need help with ‘… read more’ excerpt in functions.php
- Excerpt length: get 2 paragraphs
- Check if excerpt is empty at loop-portfolio
- How to use different jquery function of idangero swiper dependant on page template?
- Can’t change excerpt length and more tag
- More link – not text
- How to add an excerpt and read more link to a page?
- Adding a filter to my posts
- Excerpt – First Sentence & Read More
- function to show youtube videos within excerpt – if condition and apply_filters
- Logout redirect via page template without confirmation?
- Template Redirect Function Only Working When Logged In
- Remove “Category:”, “Tag:”, “Author:” from the_archive_title
- Link to user’s profile settings page?
- AJAX handler throws 400 (Bad request) – why?
- Return only top-level navigation items from a menu using wp_get_nav_menu_items
- Conditional tag is_page with a custom post type
- Child theme functions.php not executing
- How to add background image control to page admin controls?
- Retrieve post modified date for specific post by post ID
- add a function to submit options.php
- is_user_logged_in not working to redirect only logged out users
- Only let plugin add actions to wp_head & wp_footer on single posts
- Conditional Gravity Forms filter in WordPress Multisite
- Do we have to use ftp to recover from a bad functions.php edit?
- Excerpt function for any content
- custom functions in function file delete automatically daily
- Editor cannot access Theme Options
- Include widget file in functions.php of child theme
- Is there a function for setting a password to a post?
- How to reference different css (bootstrap) stylesheets for the header and body of a page?
- Author social media aren’t shown on the page
- What add_action reference should I be using or should I use do_action?
- Allow the access over wp-login.php
- Check if there is an post to be published in future
- Unhook the comment form in Buddypress
- WordPress Custom wp mail template return full template