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
- Missing feature image link function
- What’s the difference between home_url() and site_url()
- Remove “Category:”, “Tag:”, “Author:” from the_archive_title
- get_template_directory_uri pointing to parent theme not child theme
- How to customize the_archive_title()?
- remove empty paragraphs from the_content?
- What is the “with_front” rewrite key?
- Why use if function_exists?
- How to override parent functions in child themes?
- wp_enqueue_script was called incorrectly
- Add multiple custom fields to the general settings page
- Ajax call always returns 0
- 400 bad request on admin-ajax.php only using wp_enqueue_scripts action hook
- How long does a deprecated function live in core?
- Solution to render Shortcodes in Admin Editor
- How to add a data attribute to a WordPress menu item
- What’s the difference between esc_html, esc_attr, esc_html_e, and so on?
- remove_action on after_setup_theme not working from child theme
- plugins_url vs plugin_dir_url
- Remove type attribute from script and style tags added by WordPress
- How to run a function every 5 minutes?
- Best way of passing PHP variable between partials?
- Upload Multiple Files With media_handle_upload
- How to display custom field in woocommerce orders in admin panel?
- Adding fields to the “Add New User” screen in the dashboard