Opened 9 years ago
Closed 9 years ago
#28479 closed defect (bug) (invalid)
plugin shortcode invoked on one page causes other webpage plugin shortcode to also be invoked
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 3.9.1 |
Component: | Shortcodes | Keywords: | |
Focuses: | Cc: |
Description
I have a plugin that I coded myself for a particular application
This used to work properly on a Ubuntu server 12.02 LTS running in my home
I rebuilt the server to Ubuntu 14.04 LTS and re-installed everything as before.
I suspect that the WP release may have been automatically updated between the time it last ran successfully on the old server (which died on me so I can't check that) and the new release on the new server.
Since then, the plugin behaves strangely as follows
- There are two shortcodes in the plugin for two different functionalities
- One shortcode is invoked from a particular WP page and the other shortcode is invoked from a different WP page
- When the WP page containing the first shortcode is invoked, that runs as expected, but the WP page that contains the other shortcode also gets triggered somehow and that functionality is also run.
I have proved that by removing the shortcode from the second WP page and then it works fine as expected when the first WP page is invoked
I have then upgraded to the latest WP version 3.9.1 which makes no difference
I have also tried different methods of coding the shortcodes in my plugin, but every time with the same strange behaviour
The first WP page is http://192.168.1.240/automat/controllers/ and just contains the shortcode of [automat-controller]
The second WP page is http://192.168.1.240/automat/scheduler/ and just contains the shortcode of [automat-scheduler]
I have attached the latest plugin code here for reference
Please let me know if you need any more information from me to help with the debugging of this
Kind regards
Attachments (1)
Change History (5)
#1
@
9 years ago
- Resolution set to invalid
- Status changed from new to closed
It sounds to me like your first shortcode is invoking a request to the second page. If you can't think what in your code is causing this, you could try returning from your first shortcode's function early, and that will help you to isolate the problem code. By moving the return
around, you will be able to see what part of the code causes this behavior.
I'm going to close this, but you are welcome to reopen it once you have identified the problem, if it does turn out to be an issue in WordPress core.
#2
@
9 years ago
- Component changed from Plugins to Shortcodes
- Milestone Awaiting Review deleted
When the WP page containing the first shortcode is invoked, that runs as expected, but the WP page that contains the other shortcode also gets triggered somehow and that functionality is also run.
Sounds like browser prefetching, see #12603, #14382, and #20192.
See also #21658. We no longer generate adjacent links for pages in 4.0, which might help here.
#3
@
9 years ago
- Resolution invalid deleted
- Status changed from closed to reopened
Hello SergeyBiryukov
Thank you very much for your prompt response
You are spot on in your analysis in that browser prefetching is causing the issue.
I tested this by setting network.prefetch-next to false in firefox and it all works fine
The only problem here is that I cannot control what the user's browser settings will be as that could come in from anywhere, so I need to find a different mechanism for blocking this at the wordpress and/or plugin level.
It is good to hear that adjacent links for pages will no longer be generated in 4.0.
In the meantime 4.0 is not yet available as a stable version so I cannot use that yet !
Is there a way that I can achieve this easily in the current 3.9.1 stable version ?
If not I will need to make a workaround to ensure that the page I have an issue with (sort of webservice if you like) cannot make any action without the value of a parameter passed in the URL of that page. That way, Wordpress cannot create a link to that page that will have any effect other that preloading it.
It would be better to just turn that off in WordPress though
Kind regards
plugin code