Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Functions is being misread as a default WP function on theme update #356

Open
eramits opened this issue Jun 22, 2021 · 5 comments
Open

Functions is being misread as a default WP function on theme update #356

eramits opened this issue Jun 22, 2021 · 5 comments

Comments

@eramits
Copy link

eramits commented Jun 22, 2021

Hello,

We have a little problem with the new update checker rules. One of our functions (oceanwp_title()) is being misread as a default WP function (wp_title(), which is not in use in the theme at all), and we're unable to push an update. oceanwp_title has been in the theme since the very first version. We could change the function name, but first, we wanted to check if there's a way to bypass this, otherwise, all our users using custom codes related to this function will experience issues. Not to mention other possible and future issues with all functions using oceanwp in the name. Grateful for any help and feedback we can get

if ( false !== strpos( $file_content, 'wp_title(' ) ) {

dsdsd

Thank you

@aristath
Copy link
Member

The problem here is that we check if wp_title is contained, and oceanwp_title contains wp_title.
Ideally we'd look for exact word matches, so using a regex function that would be something like \bwp_title\b
Maybe we should introduce a function themecheck_function_located( $function_name ) and use that consistently everywhere instead of the strpos calls? 🤔
cc @carolinan

@carolinan
Copy link
Collaborator

Yes, a regex would be an improvement. I question whether this check should block upload at all.

@carolinan
Copy link
Collaborator

I found 11 themes (including oceanwp) that were blocked by this requirement since june 17.

The requirement is in place because wp_title was supposed to be deprecated many years ago, and it was reverted because so many themes still used it incorrectly. add_theme_support( 'title-tag' ); replaced it.

@aristath
Copy link
Member

Should the check be removed, or tweaked?
Tweaking it should be relatively easy and changing the line highlighted above to this should do it:

if ( preg_match( '/\bwp_title\b/', $file_content ) ) { 

@carolinan
Copy link
Collaborator

tweaked then kept as required :)
The message needs to be more clear and explain why.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants