You need to simply pass your current page with your ajax request.
Put this property on your “body” tag to be able to get this with JS in the future.
<body page-id="<?php get_the_ID(); ?>">
Find it in your JS
var page_id = $('body').attr("page-id")
Pass it along with your other “data”:
var data = {
action : "my_ajax_filter_search",
project_type : project_type,
page_id: page_id
}
Related Posts:
- How to display an image before title text in menu items
- Filter works on last selection but no others
- Assign IDs to headings in ACF using functions.php
- ACF Filter return value
- Remove Actions/Filters added via Anonymous Functions
- Add class to menu items of one specific menu (nav_menu_css_class)
- How to influence the information displayed on widget inside wp-admin
- How to restrict actions and filters “properly” by conditions
- Filter the query ONLY for the search results page
- opening links in new tab using – add_filter( ‘the_content’, ‘make_clickable’);
- Using add_filter() in Widgets
- Customize WordPress Media Manager – Media Window
- Is it possible to use a forgot password url filter?
- Wrap gutenberg block ‘div’ in other elements/extra HTML
- Remove Page Title from Static Frontpage
- Default or Preset Content for Custom Post Types
- Override a class function to include a custom template
- Exclude Empty Child Categories in Menu
- add_filter priority problem
- Clean-up script tags
- How to use IF Statement in WordPress?
- Gravity Forms field entries into wp_query loop [closed]
- Post Pagination Showing Same Posts Every Page
- modify a function filter
- Super simple shortcode not working
- How would go about if I just want a temporary function?
- Generating rel=prev and rel=next only on wordpress categories
- How to make applyFilters function return false via functions.php
- How to filter out shortcode when displaying the_excerpt() in the loop?
- Accepted arguments value in hook functions
- Get current page_id before loop, in functions.php
- Which action hook to use for function?
- str_replace function in theme
- Last updated date function
- Modify a function without editing template
- Having issues with a foreach inside of a shortcode with ACF gallery
- How to set default archive image without overriding first attached image? [closed]
- How to add nav menu items to a specific position within a menu
- Only let plugin add actions to wp_head & wp_footer on single posts
- Disable auto-resizing of uploaded images, but only for certain filename
- How to make custom column Admin>Users sortable?
- Filter out other users comments. Visualize only own comments and editor role users’ comments
- Output and filter data from a XML url
- Add to cart php not working [closed]
- What did I do wrong in my functions code, that will not change the “Get New Password” text to “Send It”?
- create filter in functions.php
- How to filter $content in shortcode function
- Insert image in WordPress with HTML5 tag and caption function
- How to construct function for applying filter?
- Redirect to another page using contact form 7? [closed]
- ACF not showing
- Add Element as a Filter to the_content
- How to retrieve the values of a sub-field in the first and last row of an (ACF) repeater inside function?
- How would I go about replacing this function in my child theme located in inc/template-tags.php
- Retrieve a value from Yoast SEO to use to set a default twitter card image honoring overrides
- Can’t properly set the_title add_filter to show short_URL
- (Woocommerce) Order by price when entering specific category
- Filter an WordPress Function in (general-template.php)
- Filter nav menu items HTML tags and wrap inner text with span
- Access category within rss2_head hook?
- Can set_post_thumbnail be used to remove a thumbnail?
- Modify gform_other_choice_value for specific form and specific field in Gravity Forms
- Set “woocommerce_is_purchasable” to false for specific “$product->is_stock_status”
- How to add custom li item to wordpress menu
- Is it possible to use add_filter in an included file in the child theme’s functions.php?
- Insert Content Before div#main from the functions.php File
- remove_action not working, even after changing priority [duplicate]
- remove/hide wp-editor
- Add a class to post if it has been recently updated
- how to add_filter to non hook function
- Perform function on publish AND save (not just save)
- Changing the text of Upload/Insert on Posts and Pages Screen
- Conditional custom menu?
- Get URLs for AJAX Filter Checkboxes WordPress
- How to show ACF value under post/page title in wp-admin
- Save_post – Warning: Cannot modify header information
- custom error message for empty username and password using authenticate filter not working
- Add #primary at the end of navlink permalinks on single posts
- How can I automatically delete comments that contain a URL?
- Appending „read more” to the excerpt conditionally
- How to add class dynamically from templates
- ACF Date Form in Custom Admin Field
- Prevent function from triggering on current page
- Redirect specific author posts to another url
- $content is empty while using DOMDocument
- Return ACF Field value function
- Best way to add image to recent posts widget?
- How to make an If Else on Excerpt Filter
- Providing fallback function and allow override by plugin
- Different body image backgrounds on different pages, posts and categories
- Retrieve a custom form field modified by a filter
- Print all inline styles to head
- Query Posts Via WordPress URL
- Function Reference for custom link in Admin Menu Management Page
- Force resize for all video content
- Way of getting queried loop before the query with a filter hook?
- Call ACF data from functions.php [closed]
- Trying to get this function to show below the content
- Warning: call_user_func_array() expects parameter 1 to be a valid callback
- How can I modify or filter this variable in an existing class? (Mai Theme)