admin管理员组

文章数量:1122846

I am using a specific plugin that enables basic e-commerce functionality, and am attempting to extend the plugin functionality to include payment processing on the checkout page. The plugin itself has already been heavily modified from its original source, so using updating versions of the same plugin is not viable, as there is no longer any upstream to pull from.

On the checkout page there is a form:

<form action="http://localhost:1113/index.php/checkout/" enctype="multipart/form-data" method="post">
    <input type="hidden" value="http://localhost:1113/index.php/thank-you/" name="ic_formbuilder_redirect">
    <!-- - additional stuff that is generated by a plugin formbuilder object -->
</form>

The http://localhost:1113 is simply the localhost on the development machine, so no need to worry there. The index.php immediately after the localhost url I imagine would correspond to the index.php file in the directory root of the server. Unfortunately, this doesn't make sense as the directory root of the server is not the plugins root directory, and there's quite a few intermediate directories between the server root and that root. Not to mention, the plugin itself has multiple "index.php" files inside multiple sub-directories under the plugin root directory.

That means that there must be some translation of the url going on for wordpress to actually figure out how to start processing the form data. Further, there is the /checkout/ portion of the url which just straight up confuses me, as clearly there is no php code purely within a directory location. Also, the hidden attribute value seems to be relevant, and I suspect that wherever the form is submitting to is using that attribute data to further process and redirect to a "thank you " page in some manner. I suspect that this would provide a clue as to how wordpress is handling this particular form in this context.

What I am looking for is general information for how wordpress would go about handling the submission of the form data in this instance. I'm not expecting anyone to just tell me precisely where it is. I am attempting to do research on my own.

Posting this on stack exchange is kind of my last resort because I'm having trouble actually finding information online regarding this. Everything I type into search engines has just been giving me generic AI generated blog posts about "How to setup " or "How does wordpress store pages and posts?" I'm running into similar problems with trying to find the official wordpress documentation on forms. e.g. The wordpress developer plugin handbook doesn't seem to have a section on how forms are handled at all, and I'm not sure where else to find that information, unfortunately.

Thank you for your time.

I am using a specific plugin that enables basic e-commerce functionality, and am attempting to extend the plugin functionality to include payment processing on the checkout page. The plugin itself has already been heavily modified from its original source, so using updating versions of the same plugin is not viable, as there is no longer any upstream to pull from.

On the checkout page there is a form:

<form action="http://localhost:1113/index.php/checkout/" enctype="multipart/form-data" method="post">
    <input type="hidden" value="http://localhost:1113/index.php/thank-you/" name="ic_formbuilder_redirect">
    <!-- - additional stuff that is generated by a plugin formbuilder object -->
</form>

The http://localhost:1113 is simply the localhost on the development machine, so no need to worry there. The index.php immediately after the localhost url I imagine would correspond to the index.php file in the directory root of the server. Unfortunately, this doesn't make sense as the directory root of the server is not the plugins root directory, and there's quite a few intermediate directories between the server root and that root. Not to mention, the plugin itself has multiple "index.php" files inside multiple sub-directories under the plugin root directory.

That means that there must be some translation of the url going on for wordpress to actually figure out how to start processing the form data. Further, there is the /checkout/ portion of the url which just straight up confuses me, as clearly there is no php code purely within a directory location. Also, the hidden attribute value seems to be relevant, and I suspect that wherever the form is submitting to is using that attribute data to further process and redirect to a "thank you " page in some manner. I suspect that this would provide a clue as to how wordpress is handling this particular form in this context.

What I am looking for is general information for how wordpress would go about handling the submission of the form data in this instance. I'm not expecting anyone to just tell me precisely where it is. I am attempting to do research on my own.

Posting this on stack exchange is kind of my last resort because I'm having trouble actually finding information online regarding this. Everything I type into search engines has just been giving me generic AI generated blog posts about "How to setup " or "How does wordpress store pages and posts?" I'm running into similar problems with trying to find the official wordpress documentation on forms. e.g. The wordpress developer plugin handbook doesn't seem to have a section on how forms are handled at all, and I'm not sure where else to find that information, unfortunately.

Thank you for your time.

Share Improve this question asked May 21, 2024 at 14:28 DruidDruid 1
Add a comment  | 

1 Answer 1

Reset to default 0

The URL you are looking at does not exist in the filesystem, it's a WP rewrite rule.

Ugly URLs look like this: index.php?queryvar=value

Pretty URLs look like this: /my/pretty/permalinks

But if your server does not or cannot support the needed HTAccess or rules to set up pretty permalinks, there is a workaround: /index.php/my/pretty/permalinks, where index.php is the root index.php that WordPress provides, and everything after it is piped into the WP rewrite rules system.

For example if I have this blog post: https://example.com/2024/hello-world/ then I can also visit https://example.com/index.php/2024/hello-world/, although WordPress will redirect to the first as it's the canonical URL.

Remember, WordPress is a CMS, not a bunch of standalone PHP files. All permalinks and frontend pages go through index.php even if that's hidden by server configuration, and it's WordPress that decides what gets loaded, what URL is being served, which posts to fetch, which template to load, etc and it does this in PHP code. The presence of index.php in plugin folders is irrelevant.

If there were PHP files in plugins folders that were directly contacted by the browser and handled requests, this would be a major security issue and such plugins would be rejected by most plugin reviews.

What you will want to look for are add_rewrite_rule function calls, and you'll also find useful information by plugging those URLs into a rewrite rule tester/analyser to discover the query variables behind them that power those pages

本文标签: pluginsTrying to Find the PHP FileFunction that Handles a Specific Form Action URL