do_action( 'after_setup_theme' ); doesn’t pass any parameter. You are cutting something of the length 0 after theme setup. Why?
Plus, your registration with add_action doesn’t tell WordPress that you want two parameters. The default is one parameter.
You don’t need this call at all. If you define the function in your functions.php it will be available in the loop.
Learn the Plugin API, it isn’t so hard. 🙂
Always prefix you functions. Otherwise your users may get fatal errors when someone else has written a function with the same name.
If your function does what I think it does, you may have a look at my function utf8_truncate(). No regex needed.
Related Posts:
- my blog crashes ie7?
- Are immediately-called actions not usable in themes?
- Undefined offset: 0 in > […] /wp-includes/capabilities.php on line 1067
- Loading template files from a subfolder in my theme?
- The style.css stylesheet doesn’t contain a valid theme header
- Remove action within a class in a parent theme from the child theme
- Problem : deletion failed, the theme requested does not exist
- Using a _GET gives me a debug error (over my head)
- Delete database tables on theme uninstall?
- How can I show more than 15 themes at a time in the admin menu?
- How to trigger function on theme delete?
- PHP Parse error: syntax error, unexpected end of file, expecting elseif (T_ELSEIF) or else (T_ELSE) or endif (T_ENDIF) on line 230 [closed]
- wp theme.. Could not create directory
- Console error, even if everything is working?
- Make it possible to pick a color theme for specific pages
- OptimizePress Theme Overriding add_filter page_template
- Execute filter in theme as last
- Fatal error with a theme
- Getting 503 on various files
- Redux callback action
- How to display message (with switch_theme hook) after deactivating My theme?
- What hook is the currently active theme’s functions.php file loaded on? [duplicate]
- Finding and disabling ‘rogue’ stylesheet from header: Source Sans Pro
- Remove problem PHP code entered into footer via Theme
- Twenty Seventeen search error
- Is it good practice moving the main stylesheets after the plugin styles?
- WordPress suddenly creating theme errors
- Debugging in WordPress at Theme installation [duplicate]
- Posts as filtered list – expandable
- .PO file is found but I don’t see translations: how to debug the problem?
- How can I remove all traces of a theme?
- Undefined variable error in theme option after updating theme [closed]
- Using filter in the widget causes fatal error
- Error when installing theme – “failed to open stream: No such file or directory in…”
- Functions.php error – when trying to change the theme
- My blog suddenly can’t find my stylesheet?
- How to fix Scrape key check failed on WordPress VPS?
- Why does an ad page open when I browse my websites’s wp-admin page?
- Don’t prepend WordPress base url to image paths
- Problem: Fatal error worldpress theme
- Custom CSS is overwritten by WordPress?
- The function is deprecated; use mysql_real_escape_string() instead
- Warning: call_user_func() expects parameter 1 to be a valid callback
- Firebug and Chrome rendering two body tags
- Costum Theme template directoy url problem
- How to remove the option data of a theme when that theme is removed?
- Diagnosing a connection reset problem
- Where can I find the “add_action()” inside a theme?
- “Parse error: syntax error, unexpected” and the WordPress Theme Editor no longer working!
- WordPress site is not loading properly ( showing a min-page)
- How to correctly get post type in a the_title filter
- What’s the difference between hooks, filters and actions? [duplicate]
- Load a theme based on browser detection
- How to avoid loading style.css twice in child-theme?
- Generating the ogp tags in theme
- WordPress Backup
- Problem in theme installing?
- Is possible dequeue/remove style from wp_footer() hook and add on wp_head() hook?
- Overwriting templates in child theme and performance
- Display a specific dynamic sidebar widgets on a specific page
- How do I add a TinyMCE row that all users can see, instead of just admins?
- Child theme Page Template not loading
- Contact Fom 7 – how to add custom HTML inside span.wpcf7-form-control-wrap AND IMMEDIATELY AFTER input.wpcf7-form-control?
- Browser back button does not work on firefox and safari [closed]
- Call to undefined function add_menu_page() on theme activation
- Alternative to the filter comment_reply_link
- Different logo on homepage
- Translation not working after editing plugin template
- Should all references to a text domain be to my current theme?
- How to restore file or theme?
- A /proc folder in wp-content?
- how do i in ignore/disable/delete a javascript call from parent in child theme?
- When someone likes an article on my blog, they are prompted to log in on WordPress.com [closed]
- WordPress TwentyTen Theme Incompatible with Theme Unit Test
- WordPress theme logo handling (Trying to use GIF as logo)
- Changing an image in header.php
- How to access page variable inside action hook
- Installing a theme on localhost, Ubuntu 16.04
- Unable to find translations in WordPress theme
- How to use add_action for multiple instances of the same class
- Will I lose the pages I’ve created within a default WordPress theme when adding a new theme?
- WordPress + Buddpyress – troubleshooting server overloading
- Adding tables to dashboard pages programmatically?
- Is there a way to see how a theme will look before buying it?
- Hook to add content after date in post?
- i want remove class from post links
- share wrordpress data between two shared hosts using REST API
- PHP Error in WordPress Theme
- Own WordPress theme with custom AFCs > Export all to theme format?
- Default and warning messages & no login
- Theme customizer hiding sections
- Uploaded WordPress theme not finding pages and css
- Speed issues because of CSS & JavaScript
- Updating theme resets theme options settings and widgets
- EM in CSS different size on wordpress then elsewhere [closed]
- Add Media + Quick Edit buttons not working
- WordPress Theme Problem
- wordpress not able to open theme-editor.php
- problem with custom url for images as post
- Make it easier to add, change, and update pages on existing WP website