In my setup i know there are max 3 params, so this is my solution
add_filter('request', function( $vars ) {
global $wpdb;
if(isset($vars['error'])){
$lastVar = basename($_SERVER['REQUEST_URI']);
$vars['attachment'] = $lastVar;
}
........rest off code........
}
Related Posts:
- Should all plugins be encapsulated in a Class?
- In what order does WordPress load plugin files?
- How to include a plugin’s php file to another plugin functions file [duplicate]
- How can I bulk edit variations in woocommerce? [closed]
- Add a subitem to Woocommerce section
- How to find out if option exists but is empty?
- Search and replace text across all posts
- Add Products to user’s ID Woocommerce
- Add_rewrite_rule doesn’t add custom url in plugin
- Fatal error: Uncaught Error: Call to undefined function get_userdata()
- How to add inline css/js inside a shortcode
- Upload files programmatically to users
- taxonomy_template filter do not loads custom taxonomy template properly
- Is this plugin being loaded before file.php, subsequently not allowing me to use certain functions?
- Ajax with jQuery UI dialog not working
- Shortcode in AJAX popup
- Editing Theme to apply Co-Authors Plus
- Display comments of users on single page
- How do you remove plugin edit option?
- Localiztion in javascript
- Why none of the plugins that have ajax doesn’t work in my website?
- wordpress reusable content blocks
- Is there a filter for get_post_custom()?
- Loco Translate: Custom Post and Custom Taxonomy Labels not translated in wp-admin menu
- I am getting error message on accessing menu-endpoint
- Where should I save an API key of my user when installing my plugin?
- How to make a customize role and view a specific plugins base on that role?
- Set featured image randomly from WordPress Database on post submission
- Headers Content-Security-Policy CSP Major Issue
- Woocommerce Deposit, then random payments until product paid in full [closed]
- How do I run SQL queries on a WordPress web page? [closed]
- Remove strange code from wordpress footer [closed]
- Removing an action from wp_footer called in a class that’s inside a bigger class
- How to fetch form data and show it to my page?
- How to put Word documents online so they can be downloaded, printed and read via a web page? [closed]
- How to add single function for all WordPress hooks
- How can I show a different theme for admin users? WP 3.8+
- add_action into another add_action not working
- General questions re: WordPress and WP plugins [closed]
- populating a form field with output from a custom plugin function
- Fetch Data from other website in wordpress (screen scraping)
- shortcode not return any thing in Gutnburg
- Add User Role: Pre-saved in User-Meta [SOLVED]
- How do I add a plugin dependency to my customized theme?
- How WordPress core manage the plugin installation
- Flickering sidebar when scrolling page [closed]
- Shortcode not working – quotes seems strange
- Storing The Data Collected by Ninja Forms into Another (custom) Database [closed]
- Add action to custom Function
- “Allowed memory size” problem [closed]
- count the number of views of a post excluding own views
- Remove updates text on plugin or themes list page
- WordPress slider that allows image, headline, text, and button?
- Shortcode not displaying HTML within the function
- Enqueue css to a third-party plugin template
- Preset custom fields
- How Can I Increase Breadcrumb Position Count (Starting From 2)?
- website shows blank when visiting from mobile
- Main content of site not showing, but does show when logged in to wp-admin
- No route was found matching the URL and request method
- Hide WordPress Site URL from Source Code
- Upload files with Q&A admin
- Plugin function in child theme
- How to access Post Archive created by Elementor?
- CRUD from WordPress to Business Central 365 through OData REST API
- Create multiple domains to download my custom plugin from wordpress.org
- Change the color of ACF Subtitle output background
- Move plugin upload folder from mywebsite.com/wp-content/uploads/pdfuploads to mywebsite.com/pdfs?
- Deactivate sub-plugin when parent-plugin is deactivated
- wc_get_product_terms() throws “Notice: Undefined offset: 0”
- Use WordPress Site For Email List Functionality
- WordPress showing fatal error on wp_set_object_terms line
- How do I keep children of certain parent menus expanded by default on a sidebar?
- Function get_locale always returns en_US in plugin?
- How do I add a textarea (multirow) option to my WordPress plugin?
- WordPress CPT Url metabox collection
- Passing ajax variable to more than one wordpress plugin function
- Changing the body of mail sent to new user registration
- WordPress hook source
- How to publish adobe edge animation to custom wordpress plugin
- Locale changed but plugin still showing default language
- Update post meta not working on wp_postmeta
- Slow WordPress admin panel with a total query time of 1664ms
- Alter the reset password link
- Hide Pages WooCommerce [closed]
- Fatal error with Ultimate Coupon plugin
- is there a way I can add or remove some plugin options?
- How to add homepage Widget?
- Javascript as Jquery Function Call?
- WordPress show different custom post type
- Block registration with viewScript
- I want to include My theme file (testing.php) to inside my plugin folder (myplugin/mypugin.php)
- How do I set register_meta for a specific CPT?
- How to Enfroce Domain Licensing Limits? [closed]
- Override plugin constant using a theme
- How can I save the selected page in the dropdown after anyone clicks on Save Changes?
- Update Content for a Custom Block Toolbar Button
- WordPress menu dissapear when I add a parameter to custom post archive
- Submitting form to admin-post.php WordPress
- WordPress Throwing Deprecated Errors on its own Files