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:
- How to Create a Custom Slug for Tags and Categories with a prefix or suffix?
- How to export all content with feature images?
- Cron Job not working in plugin
- this jQuery function works perfect in static html page but not on wordpress
- WordPress Image uploads plugin needed [closed]
- Sidebar widget: Randomly select text from a given set
- Run a plugin just ‘once’ per page reload
- How to make multiple admin pages for one plugin?
- redirected you too many times
- Create custom pages with a plugin
- Is it possible for a plugin to force reading and writing of uploaded images to a database instead of to a filesystem?
- $wpdb update query in plugin only updating one column
- WordPress as template engine
- Cropping images from top center using Jetpack Photon
- Amazon.com intergration with WordPress?
- XML Sitemap Generator can’t notify google and bing
- How to limit image size for the entire website ? But without editing the post (css/plugin?!)
- WordPress won’t allow for updates to plugins or WordPress Core
- Woocommerce Backend Search by Title and SKU
- Set Multiple Meta Values as an Array Using dispatch( ‘core/editor’ ).editPost() Call in Gutenberg/JS
- Minimize and Uglify WordPress Plugin Files
- Classic, but puzzling “The uploaded file could not be moved”
- Need to change link URL embedded in multiple posts to new link URL
- How do I make sure that my plugin only runs on article detail pages?
- Table is not created in WAMP
- Trying to make a simple wordpress plugin, having difficulties understanding how to make it?
- Post deleted in trash [closed]
- WordPress API functions not working at AJAX functions.php call
- wordpress plugin license issue -New plugin development
- Remove specific administrator’s capability
- Different Layerslider by page id?
- How to change Header image depending on language [closed]
- How do I show content from a plugin using the template the site is currently working with?
- WP audio video player with previous next options
- Interface needed to transfer contents in a table on a web page to the Add New Product interface
- Need to setup grid like thumbnail of recent posts on sidebar
- Looking for a filter to modify the months
- Advanced Custom Fields Plugin – Images not displaying
- use EDD Content Restriction for restricting php in template
- Save log for imports in WordPress database – options-table, custom post type or other place?
- page duplication on wordpress that wont stop
- content copy protection in wordpress
- the_posts_pagination() not working if I add wp_head() to header.php
- Need help with Task assigning and rewarding as currency which withdrawable
- Hide content for specific users with id
- adding dynamic/multiple slug values in ‘option_none_value’
- wp_set_password() does not work!
- WordPress wp get_temp_dir return non exiting folder, thus failing plugin & themes update
- main navigation menu disappear after adding jquery source file
- How to pass all received IDs through the function for in_category
- Getting unknown text in footer of email
- Insert Sponsor logo in custom own theme
- Dynamical slug on custom post type
- Compare Ajax Data Results
- WordPress delete cookie
- Else If statement for ACF [closed]
- how to hide resume from selected employer [closed]
- Convert slugs on post publish
- Storing Array of values into wordpress options
- WordPress Add advertising ads befor and after content with periority [closed]
- Upload image to wordpress using ionic/cordova with WP REST API V2
- Same Title on two different post type with single custom taxonomy
- Every time I use wp_get_current_user() my plugin breaks
- woocommerce blank page after clicking add to cart [closed]
- Working plugin code breaks admin
- CPT-onomies CPT_TAXONOMY->get_terms extremely slow with 6K posts
- wordpress option page data from select form is not saving to database
- How to use shortcode of any plugin to show it visually where i want?
- Custom User Role
- Duplicate use of WordPress plugin
- Plugin not installing properly, functions being redeclared
- WordPress automatic plugin update
- Use wordpress for school results?
- How to list posts that appear in two categories
- rss feed code help
- Woocommerce Bookings – Resource needs to be allocated for part of the booking duration, not the whole booking
- Load my plugin before cache
- How to get current template file used by WordPress?
- Is it possible to debug plugins with Xcode?
- Plugin link does not appear in my toolbar
- Supersize plugin error in internet explorer 7 and 8 [closed]
- Admin access to WordPress site with installing plugin
- Is there a method or plugin to download my products in WooCommerce?
- Add image before link in woocommerce plugin [closed]
- How to change data format in custom meta box field [closed]
- Sidebar Slideshow widget with text [closed]
- How to get an error message if a form is empty (plugin: Post for site) [closed]
- Beginner question: Accessing js script in plugin
- automation of plugin installations
- Why is my activator class adding the files/running the actions I add?
- I cannot generate new sitemap on my wordpress website
- How to Handle? vp_page Parameter in WordPress and Resolve Google Search Console Validation Issues?
- How to disable Yoast meta description for all pages
- Trying to Find the PHP File/Function that Handles a Specific Form Action URL
- Newspaper theme, custom query vars, & custom rewrite rules
- How do I resolve “Some required plugins are missing or inactive”?
- WordPress Shipment
- How to add CPT in Elementor pro search template
- plugin user-role-editor: cannot access settings page, but I’m admin?
- Long running tasks in a plugin: wp-cron vs REST API callback [closed]