Skip to content

Introduce filter that edits the file path of the llms.txt file#22340

Merged
thijsoo merged 4 commits intorelease/25.4from
624-allow-users-to-change-the-absolute-filesystem-path-via-filter
Jun 11, 2025
Merged

Introduce filter that edits the file path of the llms.txt file#22340
thijsoo merged 4 commits intorelease/25.4from
624-allow-users-to-change-the-absolute-filesystem-path-via-filter

Conversation

@leonidasmi
Copy link
Copy Markdown
Contributor

@leonidasmi leonidasmi commented Jun 11, 2025

Context

Summary

This PR can be summarized in the following changelog entry:

  • [wordpress-seo bugfix] Fixes a bug where the llmst.txt file wouldn't be able to be generated in wp.com.
  • Introduces the wpseo_llmstxt_filesystem_path filter that allows editing the file path of the llmst.txt file, to help users in servers with filesystem restrictions.

Relevant technical choices:

Test instructions

Test instructions for the acceptance test before the PR gets merged

This PR can be acceptance tested by following these steps:

  • Re-generate the llms.txt file and confirm that you see it being created in the webroot of your filesytem (aka, the place it was created before this change) (aka, the directory that contains the wp-config.php file)
  • Add the following snippet:
add_filter( 'wpseo_llmstxt_filesystem_path', 'custom_llmstxt_file_path', 10 );
function custom_llmstxt_file_path() {
    return WP_CONTENT_DIR ;
}
  • Re-generate the file and confirm that you find it in the directory of the wp-content.

For WP.com:

  • Let's please test in wp.com also to cover the cases where get_home_path() is not writeable.

Relevant test scenarios

  • Changes should be tested with the browser console open
  • Changes should be tested on different posts/pages/taxonomies/custom post types/custom taxonomies
  • Changes should be tested on different editors (Default Block/Gutenberg/Classic/Elementor/other)
  • Changes should be tested on different browsers
  • Changes should be tested on multisite

Test instructions for QA when the code is in the RC

  • QA should use the same steps as above.

Impact check

This PR affects the following parts of the plugin, which may require extra testing:

UI changes

  • This PR changes the UI in the plugin. I have added the 'UI change' label to this PR.

Other environments

  • This PR also affects Shopify. I have added a changelog entry starting with [shopify-seo], added test instructions for Shopify and attached the Shopify label to this PR.

Documentation

  • I have written documentation for this change. For example, comments in the Relevant technical choices, comments in the code, documentation on Confluence / shared Google Drive / Yoast developer portal, or other.

Quality assurance

  • I have tested this code to the best of my abilities.
  • During testing, I had activated all plugins that Yoast SEO provides integrations for.
  • I have added unit tests to verify the code works as intended.
  • If any part of the code is behind a feature flag, my test instructions also cover cases where the feature flag is switched off.
  • I have written this PR in accordance with my team's definition of done.
  • I have checked that the base branch is correctly set.

Innovation

  • No innovation project is applicable for this PR.
  • This PR falls under an innovation project. I have attached the innovation label.
  • I have added my hours to the WBSO document.

Fixes #

@leonidasmi leonidasmi added the changelog: other Needs to be included in the 'Other' category in the changelog label Jun 11, 2025
@leonidasmi leonidasmi added this to the 25.4 milestone Jun 11, 2025
@leonidasmi leonidasmi marked this pull request as ready for review June 11, 2025 11:07
Copy link
Copy Markdown
Contributor

@thijsoo thijsoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me! CR + ACC

@thijsoo thijsoo merged commit 1424cd1 into release/25.4 Jun 11, 2025
27 checks passed
@thijsoo thijsoo deleted the 624-allow-users-to-change-the-absolute-filesystem-path-via-filter branch June 11, 2025 13:52
@coveralls
Copy link
Copy Markdown

coveralls commented Jun 11, 2025

Pull Request Test Coverage Report for Build f1dbf409784f8b283ddf15ad68185f1120c47884

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 0 of 2 (0.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.5%) to 53.157%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/llms-txt/infrastructure/file/wordpress-file-system-adapter.php 0 2 0.0%
Totals Coverage Status
Change from base Build 97ee3884b12b4536227931ffd507b3ed271ff3aa: -0.5%
Covered Lines: 29826
Relevant Lines: 57039

💛 - Coveralls

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog: other Needs to be included in the 'Other' category in the changelog

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants