It’s not working because:
- You are redirecting home
- You don’t listen for the
$_GET
variable so the archive link is just appended to your home url
You need to add a function that listens for that $_GET
variable.
just add this to your functions.php
file
add_action( 'template_redirect', 'wpse_archive_select' );
function wpse_archive_select(){
if( isset( $_GET[ 'archive-dropdown' ] ) ){
die( wp_safe_redirect( $_GET[ 'archive-dropdown' ] ) );
}
}
Related Posts:
- How to add “on change” to a text input in contact form7?
- How to change number field to text field using JS
- Can’t bind to ‘ngModel’ since it isn’t a known property of ‘input’
- Reactjs – Form input validation
- Angular: mat-form-field must contain a MatFormFieldControl
- No value accessor for form control
- Send POST data using XMLHttpRequest
- Setting onSubmit in React.js
- jQuery AJAX submit form
- How to reset a form using jQuery with .reset() method
- JavaScript post request like a form submit
- Phone mask with jQuery and Masked Input Plugin
- How to create a HTML Cancel button that redirects to a URL
- What does ngf-select do and why is it needed for form validation?
- JavaScript post request like a form submit
- How can I get form data with JavaScript/jQuery?
- {“error”: “Please use POST request”} – alternative solution to submitting a form
- FormData append not working
- JavaScript code to stop form submission
- how to write javascript code inside php
- What’s a Good Javascript Time Picker?
- ngular is automatically adding ‘ng-invalid’ class on ‘required’ fields
- Add custom form to theme
- How do I embed a Javascript form directly into a page?
- How to load javascript file on homepage in WordPress in order?
- Gutenberg get core data – search
- Change/Replace keyboard character on keypress while writing new post
- How do you filter the list of states when country is selected? [closed]
- Uncaught ReferenceError: jQuery is not defined – although jQuery is loaded [closed]
- Why does a on Comment edit page submit the page?
- Add captcha validation to my custom form for Frontend posting
- How to add a onclick attribute to a list of checkboxes?
- Close modal window after form submit [closed]
- Form will not popup, when clicking on the link to the form
- How to show cities according to the state in Form using Javascript? [closed]
- Can’t Listen to KeyDown in TInyMCE Iframe (jQuery) and Pass it to Parent HTML FORM
- Error handling for wpdb error – displaying an error message to the user
- dropdown does not work [closed]
- CCF7 Field numbuer prefilled after Click event
- Sending GravityForms to custom HTML
- Check if a string has a certain piece of text [duplicate]
- How to convert a string to an integer in JavaScript?
- How to create an associative array in JavaScript literal notation
- Include another HTML file in a HTML file
- Cannot open local file – Chrome: Not allowed to load local resource
- React Native: this.setState is not a function
- How to perform string interpolation in TypeScript?
- forEach is not a function error with JavaScript array
- Short circuit Array.forEach like calling break
- How do I format date in jQuery datetimepicker?
- Express Render not working return error: No default engine was specified and no extension was provided
- Remove Object from Array using JavaScript
- Angular4 – No value accessor for form control
- What is the difference between ( for… in ) and ( for… of ) statements?
- TypeError: Cannot read property “0” from undefined
- How to use npm jquery module?
- Why is my asynchronous function returning Promise {
} instead of a value? - NodeJs : TypeError: require(…) is not a function
- Sort array by firstname (alphabetically) in Javascript
- Sorting arrays in javascript by object key value
- jQuery: Check if div with certain class name exists
- Objects are not valid as a React child. If you meant to render a collection of children, use an array instead
- How does AJAX work?
- How to remove all duplicates from an array of objects?
- Finding the average of an array using JS
- Input Type URL – Says “Please enter a URL” if HTTP is not included
- Creating a div element in jQuery
- e.target.value on an input field ReactJs, how does it work?
- Does ECMAScript 6 have a convention for abstract classes?
- Why is jquery show() not working in example
- console.log showing contents of array object
- How can I use jQuery to run MySQL queries?
- Using setTimeout on promise chain
- Regular Expression to reformat a US phone number in Javascript
- Positioning element at center of screen
- Get hours difference between two dates in Moment Js
- JQuery Number Formatting
- How to add jQuery in JS file
- Get query string parameters url values with jQuery / Javascript (querystring)
- trying to enqueue script in wordpress
- Does javascript have an equivalent to PHP’s preg_replace_callback?
- WP REST – video and audio players
- Inserting ads within content
- Theme Customiser not live previewing changes on pseudo elements
- Instantiate TinyMCE via JS ( rather than PHP/wp_editor )
- Use useSelect/useDispatch instead of withSelect/withDispatch
- Trouble adding JavaScript in visual editor (Sharpspring embed code)
- How to set translations in javascripts for my plugin?
- How to make wordpress URLS google friendly for ajax driven sites?
- Google PageSpeed Enable Compression isn’t working?
- How can I add Javascript in the header of all post pages and only post pages
- wp_enqueue_script not loading my custom js file
- add onchange to select in a wp form
- AddThis Sharing Bar Not Displaying on Custom Page Template – JS conflict?
- Add JavaScript-Library “Fitty” to WordPress
- Access checks with custom REST endpoints and backbone
- jQuery + more won’t load in header
- Simple email input store in database
- How to add additional JavaScript code [duplicate]
- JavaScript errors