Here’s a potential solution using the page_link
filter and testing for the presence of a meta key to add a query arg:
function wpa84303_page_query_arg( $permalink, $page, $sample ) {
if( $query_arg = get_post_meta( $page, 'query_arg', true ) )
$permalink = add_query_arg( 'id', '0', $permalink );
return $permalink;
}
add_filter( 'page_link', 'wpa84303_page_query_arg', 10, 3 );
Add a custom field to the page with the key query_arg
and give it any value, if the key exists then ?id=0
will be appended via the add_query_arg
function.
Related Posts:
- How to append a URL parameter to all outbound URLs
- Is there an equivalent of the PHP function sanitize_key in Gutenberg?
- preserve url parameters from affliliate sites
- How to use div -ids in url to jump to specific post…Is trailing slash the culprit?
- Insert “javascript:void(0);” into URL
- Redirect to another page using contact form 7? [closed]
- TinyMCE Javascript URL Question
- Taxinomy slug as var in parent archive page, without having a specific taxinomy page
- Understanding unique keys for array children in React.js
- (Google Map API) Geocode was not successful for the following reason: REQUEST_DENIED
- Generate random number between two numbers in JavaScript
- Difference between npx and npm?
- How do I copy to the clipboard in JavaScript?
- Array of JSON Objects
- Cannot read property ‘push’ of undefined when combining arrays
- window.onload vs document.onload
- How to call an async arrow function with await
- Get the current URL with JavaScript?
- How do I empty an array in JavaScript?
- What’s the difference between event.stopPropagation and event.preventDefault?
- Firebase Permission Denied
- Using Javascript in CSS
- How can I mock an ES6 module import using Jest?
- What is “assert” in JavaScript?
- How does the data-toggle attribute work? (What’s its API?)
- SyntaxError: Cannot use import statement outside a module
- Appending to an object
- What is the meaning of “$” sign in JavaScript
- How to determine the installed webpack version
- Error: Failed to execute ‘appendChild’ on ‘Node’: parameter 1 is not of type ‘Node’
- How to validate date with format “mm/dd/yyyy” in JavaScript?
- Uncaught Invariant Violation: Too many re-renders. React limits the number of renders to prevent an infinite loop
- node-request – Getting error “SSL23_GET_SERVER_HELLO:unknown protocol”
- React.js – Can’t read property of undefined
- SyntaxError: import declarations may only appear at top level of a module
- Jest TypeError: Path must be a string. Received undefined
- Why is marquee deprecated and what is the best alternative?
- For loop for HTMLCollection elements
- Refresh/reload the content in Div using jquery/ajax
- How to take keyboard input in JavaScript?
- Convert CSV data into JSON format using Javascript
- Can not solve: Geocode was not successful for the following reason: OVER_QUERY_LIMIT
- SyntaxError: Use of const in strict mode
- d3 is not defined – ReferenceError
- How can I get form data with JavaScript/jQuery?
- How do I load an HTML page in a div using JavaScript?
- Check time difference in Javascript
- ReactJS – .JS vs .JSX
- How to convert date to timestamp?
- ReactJS: Maximum update depth exceeded error
- What does “export default” do in JSX?
- Strip all non-numeric characters from string in JavaScript
- Javascript – Track mouse position
- Finding the max value of an attribute in an array of objects
- How to initialize an array’s length in JavaScript?
- How to set text color for my d3 chart title?
- Defining a HTML template to append using JQuery
- Remove slug from custom post type post URLs
- Using custom/dynamic “slug” for a page
- Adding javascript to child theme
- What does l10n.js do in WordPress 3.1? And how do I remove it?
- How to add javascript just before the closing body tag in the footer of WordPress
- Open media frame and select an attachment
- Loading Javascript Only When Specific Content Existing in a Post?
- How to pre-fill Google Forms URLs with logged-in WordPress user’s data
- Use of Javascript with Dojo/Dijit on a WordPress page
- WordPress loads whole jQuery UI library
- wp_register_script unable to link bootstrap JS
- Javascript that will execute on only child pages of a specific parent
- How do I change number of columns in a proper way in twentyfourteen child theme?
- What is the Javascript event for an item being added to the cart in Woocommerce?
- How do I embed a Javascript form directly into a page?
- Can the index.asset.php file be used with the enqueue_block_editor_assets action?
- Using wp.data.select get actual tags (not id’s) used in post
- JavaScript && operator in visual editor
- How to deal with the confliction between PHP-Markdown and MathJax?
- Programatically update posts in database from one block to another using transform
- Mouse wheel Auto scroll to anchor [closed]
- Adding inline JavaScript encoding issue
- a child theme not de-registering a patent javascript file
- Custom Gutenberg-Block esnext pass variables
- How to read inline-CSS from Gutenberg block?
- javascript not loading
- Using javascript on my site to create nested tabs
- How does WP determine the difference between a post and a page url
- creating a static HTML/JS/PHP page
- Newest version of javascript
- wp_enqueue_script does not recognize my js file?
- What to include to use jQuery UI Auto Complete
- create timestamp links to jump to specific times on rumble videos
- Get nice name of category from slug (remove dashes of category)
- script not working anymore after saving widget settings
- Loading two versions of same JS libary
- Error handling for wpdb error – displaying an error message to the user
- load-scripts.php loads incorrect file names
- JS enqueue path (localhost)
- Add Javascript/Html into a WordPress
- Passing object to FormTokenField suggestions
- How to Update a variable even if the web page reloads in js
- How do i get an Inline style in Gutenberg Block show up in front end?