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

Migrate private mu-plugin to theme functions.php #346

Open
dd32 opened this issue Feb 22, 2022 · 2 comments
Open

Migrate private mu-plugin to theme functions.php #346

dd32 opened this issue Feb 22, 2022 · 2 comments
Labels
[Type] Question Needs input from others before actionable

Comments

@dd32
Copy link
Member

dd32 commented Feb 22, 2022

On WordPress.org we have a mu-plugin active for the news site, main-network/site-main.php, which has various filters including:

  • The [credits] shortcode
  • archives/12345 links (can probably stay)
  • old-slug redirect fixing for podcasts (query alterations below break it I think?)
  • File upload max size (can probably stay)
  • Query alterations:
    • Podcasts to appear as /YYYY/MM/{$title}/
    • Podcasts to be included in post query blocks (for front page)
    • Podcasts to be included in the main News feed
  • Adding the Podcast category to Podcasts when displayed within a post archive
  • Adding the WP Briefing: prefix to podcasts when displayed within Feeds

Some, if not all, of these can probably be moved into the theme.

Creating this here for context for others that a) this mu-plugin exists and does these things and b) as a tracking/future-reminder for where the related code is.

@dd32 dd32 added the [Type] Question Needs input from others before actionable label Feb 22, 2022
@iandunn iandunn added this to the Post-Launch Iteration 2 milestone Feb 22, 2022
@iandunn
Copy link
Member

iandunn commented Feb 22, 2022

Would it be better to put it in wporg-mu-plugins, so that it persists across theme changes? I wouldn't expect to find any of those things in a functions.php.

@dd32
Copy link
Member Author

dd32 commented Feb 23, 2022

so that it persists across theme changes? I wouldn't expect to find any of those things in a functions.php.

Hmm... I guess. But I don't really consider that to be a good reason, since it's one-and-the-same site. I guess I don't really believe in Plugin-Theme separation when it comes to site-specific themes.

I guess a middle-ground could be to create a /source/wp-content/mu-plugins/ folder within this repo, and sync it to dotorg with the proper loaders.

Would it be better to put it in wporg-mu-plugins

https://github.com/WordPress/wporg-news-2021/blob/trunk/source/wp-content/themes/wporg-news-2021/functions.php#L148-L171 is what triggered me to make this issue, combined with the fact that some of the code in the mu-plugin affects how the Theme renders/displays queries.

One one hand, i'd be happy to see us open-source the mu-plugins/{main,make}-network/ folders, on the other hand, there isn't much benefit in open-sourcing them like that, because they're tightly-coupled to the WordPress.net network structure, rather than to the theme being run on a site.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Type] Question Needs input from others before actionable
Projects
None yet
Development

No branches or pull requests

2 participants