What is amp
? Is it tag or category or page? You should use standard wordpress functions like is_page()
is_category()
is_tag()
.
You can also use $wp->request
. It will return the request URI. If the address is "http://example.com/slug1/slug2"
it will return slug1/slug2
then use explode()
function to split it.
<?php $uri = $wp->request;
$slugs = explode("/",$uri);//variable $slugs will have array of slugs
//$slugs[count($slugs)-1] will return last slug
if($slugs[count($slugs)-1] != "amp") {
//Apply your filter filter here
}
?>
Remember $wp is a global variable so if you want to use it inside a function the must use the keyword global
before it.
Related Posts:
- How to make a image-size selected by default in Media upload – WP v3.5
- Apply class to every paragraph that holds image?
- Remove “Insert from URL” link in Media upload – WP 3.5
- static variable loop not working in WordPress
- adding a filter to a shortcode?
- Set media upload attachment link to none and hide it in WP v3.5
- Change the footer text on the login page
- add_filter to post-gallery and remove all ‘s?
- How to overwrite youtube embed?
- Rewriting search and pagination base
- Check if page parent has certain template
- Change comments form title on a page by page basis
- Remove class that has been added by parent theme
- How do I know what variables are passed in a filter/action and what their meaning is?
- Why do filters/actions require an argument count?
- How to use return in my custom function instead of echo
- Run a filter when a walker runs
- Handling Body class based on Template
- Get_avatar filter?
- Add a class to the anchor tag on HTML5 gallery
- add_action shortcut?
- How can I remove a function that has been added to wordpress with add_filter?
- How to control WordPress image metadata (using Imagick)?
- How do I add custom bulk actions to multiple custom post types?
- Add data attribute to each li in menu
- Removing “wpautop” (auto tags) only on certain pages?
- Print last modified date only on posts
- WordPress Gravatar filter is removing my custom attributes
- Generating an nonce for Content Security Policy and all scripts – How to make it match/persist for each page load?
- Unique icons next to each WordPress menu item
- Alter required message using comment form api
- Add item to top of menu using a filter in functions.php
- How to make modifications only to certain elements of an HTML string on the server-side?
- Override a function defined in wp-includes/comment-template.php
- Filtering a function’ output for a new continued function
- Deleting Certain terms from appearing on the front end as links
- Content filter won’t work
- Warning: in_array() null given in PHP function
- Upload multiple files in randomly generated folder using wp_upload_bits
- Create page template via functions.php?
- Add meta tags to a custom header
- How to have different site identity logos on each page on Astra Theme [closed]
- Custom query vars filters problem with pagination
- Get the name of menu item with wp_nav_menu
- How to add aria role and schema markup to custom walker container
- Must filter functions receive all arguments passed to them?
- User filter posts by year
- How to remove get_header From all single pages in wordpress with functions.php without plugin?
- Change lost password url to a mailto URL in WordPress
- Remove span tags from WooCommerce Downloads page
- How to bind each “the_content” elements to a custom variables
- Reload page with a different shortcode when a user selects from a dropdown
- WordPress Ajax filter: Create two loops for different output styles?
- Custom Bulk Actions handler not firing
- How to generate customized filtered output for the gallery
- How to remove title tag with this filter
- str_replace not preserving whitespace
- Woocommerce Price Text
- Limit Taxonomy Parents
- Display a post based on its metabox selection
- Search box background on a different page template
- Display a list of users with avatar filterable with alphabets
- AJAX: WordPress filters inside $html do not work as intended
- Assign new post author IF another user in custom field on post transition
- Add attribute to featured image with filter (wp_get_attachment_image_attributes)
- How to add different menu items on different menus?
- How to pass value to add_filter wpcf7_form_tag from another function?
- Add text below WooCommerce short description if metabox value is true
- Is there a hook that I can use when a fatal error occurs?
- Customize default settings on new sites on multisite
- Design view breaking on Pages
- Hooking new functions to actions + passing parameters
- WooCommerce: Add Payment Gateway Field to Webhooks [closed]
- Why does my callback function not work with this custom filter hook?
- WordPress check if current taxonomy has child
- get_theme_mod outputs number when using WP_Customize_Cropped_Image_Control
- Conditional On custom field plugin metabox
- Exclude function from running on a certain page
- I want to hide “sold by” on certain pages with id page 43
- How to change order inside foreach using wp_enqueue_script?
- How do I get the value of a current user’s custom field?
- Adding extra data to shortcode attributes and pass it to JS with wp_localize_script
- Allow Comments by Default for Multiple Post Types
- How to get User Avatar Image with link to Author and User name in Html Title tag?
- How to get all users by user_login as a json_encode array?
- Hide the content before the more tag in the “single page”
- how to loop through blog posts in php
- Custom Navigation Bar JSON Syntax Error in JSON at Position 0
- How to extract URLs from wordpress taxonomies
- Warning: Illegal string offset ‘post’ and ‘page’
- Remove content links (internal and external), but exclude post at specific categories
- Best way to delete/don’t load a .php file?
- Get collected weight ordered per shipment method
- can someone help me what’s wrong with this code?
- How call WordPress shortcode inside function file
- strict custom php script on specific product category [closed]
- Add adjacent post function inside custom recent post function
- Customize Notification Email Sent to New User When Manually Created by Site Administrator
- Fatal Error: Uncaught ArgumentCountError: Too few arguments to function – on logout of wordpress dashboard
- Why is my custom email notification after purchase not sending?