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

Adds wpAdminUrl hook #1897

Open
wants to merge 3 commits into
base: canary
Choose a base branch
from
Open

Adds wpAdminUrl hook #1897

wants to merge 3 commits into from

Conversation

theodesp
Copy link
Member

@theodesp theodesp commented May 30, 2024

Tasks

  • I have signed a Contributor License Agreement (CLA) with WP Engine.
  • If a code change, I have written testing instructions that the whole team & outside contributors can understand.
  • I have written and included a comprehensive changeset to properly document the changes I've made.

Description

This PR adds a new hook called wpAdminUrl that lets users alter the wp-admin url.

Related Issue(s):

#1882

Testing

  1. Add the following plugin hook into the example project:
import { setConfig } from '@faustwp/core';
import templates from './wp-templates';
import possibleTypes from './possibleTypes.json';

import { FaustHooks, FaustPlugin } from '@faustwp/core';

export class MyPlugin {
  apply(hooks) {
    const { addAction, addFilter } = hooks;

    addFilter(
      'wpAdminUrl',
      'my-namespace',
      (wpAdminUrl, context) => {
        console.debug('wpAdminUrl', wpAdminUrl);
        return wpAdminUrl.replace('/wp-admin', '/wp/wp-admin')
      },
    );
  }
}
/**
 * @type {import('@faustwp/core').FaustConfig}
 **/
export default setConfig({
  templates,
  plugins: [new MyPlugin()],
  experimentalToolbar: true,
  possibleTypes,
});
  1. Open the example project site and review the toolbar url. It should show the updated path:
/wp/wp-admin/admin.php?page=graphiql-ide

Screenshots

Screenshot 2024-05-30 at 15 29 24

Documentation Changes

Needs to add entry in https://faustjs.org/reference/faust-plugin-system-filters

Dependant PRs

@theodesp theodesp requested a review from a team as a code owner May 30, 2024 14:23
Copy link

changeset-bot bot commented May 30, 2024

🦋 Changeset detected

Latest commit: 003e757

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@faustwp/core Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Contributor

github-actions bot commented May 30, 2024

📦 Next.js Bundle Analysis for @faustwp/getting-started-example

This analysis was generated by the Next.js Bundle Analysis action. 🤖

⚠️ Global Bundle Size Increased

Page Size (compressed)
global 246.79 KB (🟡 +3 B)
Details

The global bundle is the javascript bundle that loads alongside every page. It is in its own category because its impact is much higher - an increase to its size means that every page on your website loads slower, and a decrease means every page loads faster.

Any third party scripts you have added directly to your app using the <script> tag are not accounted for in this analysis

If you want further insight into what is behind the changes, give @next/bundle-analyzer a try!

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

Successfully merging this pull request may close these issues.

None yet

1 participant