Questions tagged [filters]

A type of hook that provides a way for content to be overridden programatically

Filter by
Sorted by
Tagged with
-1 votes
0 answers
5 views

How to make shortcode wordpress filter and ordering 1 category from woocomerce

How to make shortcode wordpress filter and ordering only 1 category from woocomerce? when i try to make the shortcode i cannot ordering 1 category, because all of category automatic show, same if ...
user avatar
0 votes
0 answers
16 views

User filter posts by year

I am looking to add a filter to a page so users can select the year and view only posts from that year. Something similar to the filter on this page: https://www.economist.com/weeklyedition/archive A ...
user avatar
  • 101
0 votes
0 answers
32 views

manage_shop_order_posts_custom_column() hook is Not working In Functions.php file in my WordPress active theme

As I added the manage_shop_order_posts_custom_column() hook in the functions.php file But the custom column post data not showing on the shop_order page. manage_edit-shop_order_columns Filter is ...
user avatar
0 votes
0 answers
17 views

merge 2 product attributes to use in a filter [closed]

so i have a few product attributes: "review_name_1" and "review_name_2" wich are website names of product reviews. And i would like to create another attribute review_names, but ...
user avatar
0 votes
0 answers
12 views

Sql query does not work well

I have a problem with a SQL query in wordpress. I create a query that return product_ID of products that have one or more attribute. I have highlighted my problem. I want to displya the product that ...
user avatar
0 votes
0 answers
4 views

How to Edit Ecommerce filters URL, h1, h2 , Title

I'm working in a Real Estate Website with filters for location, price. I'm trying to edit URL permalinks, H1, H2 to make more SEO Friendly. For example I would like to change https://www....
user avatar
0 votes
0 answers
12 views

Display custom product option in admin order details

I'm trying to display the custom product option in admin order panel. I was able to pass all the data until the order is completed, but in the admin panel the data is returned is empty array. I share ...
user avatar
0 votes
2 answers
17 views

Filter nav menu items HTML tags and wrap inner text with span

I am using the following filter to select <a> tags from a specific menu that have no attributes (href, class, etc.) and replace them with <button> tags. add_filter( 'wp_nav_menu_items', '...
user avatar
0 votes
0 answers
37 views

Warning: urlencode() expects parameter 1 to be string, array given in callback [closed]

I'm trying to filter product with ajax and when i sent data to ajax function it's Shows Error in output as Warning: urlencode() expects parameter 1 to be string, array given in C:\Users\Loha\Sites\...
user avatar
0 votes
1 answer
35 views

How to add nonce tag to inline script for CSP

Is it possible to add nonce tag to inline scripts for wordpress sites using ? I have used a filter script_loader_tag + function for adding tags before but it adds nonce tag only to with src tag. ...
user avatar
0 votes
2 answers
26 views

How to replace username with email address in users table

I have a custom built site that does not use usernames and everything requires use of their email address. The username is auto generated and looks bad in the table. I know there are filters and ...
user avatar
  • 195
0 votes
1 answer
24 views

How do I add <div> tags to entire comments, not just their text

Thanks to some wonderful help here at stack exchange, I have built a comment section with a dropdown menu that adds comment_meta to the comments. I currently have a working filter that uses GET to ...
user avatar
0 votes
1 answer
19 views

How can i filter wordpress users by custom feild?

I'm displaying users (authors) on a page. how can I add a filter based on user custom feilds? <?php // THE USER QUERY ARGS $args = [ 'role' ...
user avatar
0 votes
0 answers
10 views

Same URL for portfolio and for a page creates 404 error. Is there any filter that i can use for a child page?

What I try to achieve is to have the portfolio slug as a page slug also, and when I will assign the page as a parent to another, then that page must look for a specific page's parent ID and return the ...
user avatar
  • 11
0 votes
1 answer
24 views

can't modify post title using the_posts filter

I tried to modify post title and content, content is modified in output, but title stays intact: function filter_the_posts( $array , $oQuery) { ... $array[0]->post_title='new title'; $...
user avatar
0 votes
1 answer
26 views

Prevent posts with certain post_meta to be edited

So I am looking at adding some custom post_meta to posts and I want those posts to not be editable, which will be some content that I am pulling in. Here is what I have: I have solved the issues when ...
user avatar
  • 3
2 votes
1 answer
108 views

Find variables available at a given hook

I'm hoping for a simple way to tell/find/echo what the available arguments are available for use at a given hook. For example — function example_function($something){ //do stuff with $something ...
user avatar
  • 123
4 votes
1 answer
64 views

How can I register a new REST context?

I'm using the REST API to get datas from Wordpress within my React App. I've seen that you can filter the responses Wordpress returns by using the filter rest_prepare_{$this->post_type} documented ...
user avatar
  • 452
2 votes
0 answers
38 views

How do I replace a render_callback function for a block?

I like to basically use a modified version of the below function. There is pre_render_block and other filters. I have not found out how to get attributes and context the exact way that function does. ...
user avatar
0 votes
1 answer
23 views

Why does admin_body_class not work?

I'm trying to add the body class of the current user role to both the frontend and the admin backend. Why does admin_body_class not work for admin? The comment to this question does not work: How to ...
user avatar
0 votes
0 answers
21 views

How to fix select filter on category

I created a filter where I can filter on different types of machines by a custom taxonomy. It shows the right taxonomies in the filter and after submitting the right url is shown. Problem is that ...
user avatar
0 votes
0 answers
18 views

How to add a custom filter (by coding) before access one wordpress page ? And where to call the custom filter?

My requirement is to create a survey in wordpress, and the user needs to log in before answering. But the login page uses our own business account, so we created a login page ourselves (using .net ...
user avatar
0 votes
0 answers
26 views

Want to create custom design of progress indicator in wpforms

Is there any way to create custom design of progress indicator of multistep form in wpforms. By default wpforms has three templates to chose from. I have chosen progress bar which has design like this ...
user avatar
1 vote
1 answer
40 views

if role is logged in then do something

I need some pro eyes please. Over all, I'm adding one button/link to the MAIN NAV depending on the logged in role. I have this “working” code: if ( ! function_exists( 'add_extra_item_to_nav_menu' ) ){ ...
user avatar
0 votes
1 answer
40 views

How to sort WooCommerce products page by latest in-stock items first?

How to sort the WooCommerce products page by latest in-stock items first and all the out-of-stock items to the last? Currently, I'm using a code snippet from "https://www.businessbloomer.com/...
user avatar
0 votes
0 answers
49 views

Filter sub-category from checkbox form

I’m having have a checkbox filtering issue in wordpress - Please have a look at the details below - Any help would greatly be appreciated! What I’ve built: I created three custom taxonomies of topics, ...
user avatar
0 votes
1 answer
39 views

wp_dropdown_categories() works correctly but the list is not filtered in admin for custom post type. What is the problem?

When the filter is executed the correct query is passed as edit.php?s&post_status=all&post_type=banner&action=-1&m=0&banner_cat=31&filter_action=Filter&paged=1&action2=-...
user avatar
  • 59
0 votes
1 answer
23 views

How can I add a filter for specific categories on functions.php?

Hi, I am on functions.php and I want to add this filter: function graphene_alter_the_query( $request ) { $dummy_query = new WP_Query(); $dummy_query->parse_query( $request ); if (!...
user avatar
  • 133
0 votes
0 answers
17 views

Replace Data In Post & Update Meta Field Post Is Saved

I'm a bit lost & I'm wondering if someone can help. I have a post that is being generated from a podcast feed. That feed contains an audio player using the <audio> tag. I wanted to remove ...
user avatar
0 votes
0 answers
9 views

post_orderby filter breaks function

I have a custom shortcode function to display a list of articles. The list needs independent styling based on the post tag. That part all works. I need it to be sorted by term_order. I created a ...
user avatar
  • 1
0 votes
0 answers
20 views

How to add filters to my site?

I've just started to use Wordpress for a few days to build a website. How can I add customizable filters to my site? I'm using a free version, if this requires a payment? Which ones should I choose (I ...
user avatar
0 votes
0 answers
34 views

conditional filter

I'm trying to set up a filter that shows upcoming events (if any) or shows past events; function events_function($date_args){ $date_args = array( 'post_type' => 'evento', '...
user avatar
  • 1
0 votes
0 answers
18 views

Filter Media by attached page or blog post in Library

I am trying to create a filter using restrict_manage_posts that will filter all media according the page or post type that have been attached to. Actually i need to create a filter that refers to the ...
user avatar
0 votes
1 answer
82 views

Disable Remember Me in Login Form

I need to disable the 'Remember Me' prompt in login screens. Based on answers here https://wordpress.stackexchange.com/a/306746/29416 (including my own answer from 2018 with code that I had working ...
user avatar
0 votes
1 answer
19 views

custom filtering admin columns

i'm trying to add custom filters to a CPT job-offer, for example, i'm starting by locations. the filters works fine except when i try to filter by all locations. this is my code function ...
user avatar
0 votes
0 answers
14 views

How to stop DOMDocument destroying embeds?

I am making use of PHP's DOMDocument to carry out two DOM operations on the post content, by filtering the_content: Wrap a certain element pattern in a div. Add a class to a particular element. The ...
user avatar
0 votes
0 answers
25 views

'manage_users_custom_column' is a filter, but 'manage_posts_custom_column' is an action. Why?

I've been implementing some custom columns in admin tables for a Wordpress project, and I was caught out by the differences between manage_users_custom_column and manage_posts_custom_column (or ...
user avatar
0 votes
2 answers
52 views

Filter content for get_the_content()

I Need to filter content for posts. If the user is not logged in, then the post content should display "please log in....". If he is logged in, then he can see the post content. I wrote the ...
user avatar
1 vote
1 answer
106 views

How to add numeric slug for child page in WordPress 5.9?

I am trying to configure WordPress 5.9 to allow numeric slugs for child pages. Drawing from the 2015 answer to a similar question I took the up-to-date code of wp_unique_post_slug, removed || ...
user avatar
0 votes
0 answers
23 views

Is it better to use a constant or apply_filter?

I'm using WPML, which has several ways to access the current language. ICL_LANGUAGE_CODE if( ICL_LANGUAGE_CODE === 'en' ){ // Do stuff } apply_filter( 'wpml_current_language', null )' docs $lang = ...
user avatar
  • 608
0 votes
0 answers
22 views

How to register dynamic settings in WordPress Customizer?

I have been experimenting with the Customizer JS API to create Panels, Sections, Settings and Controls in the Customizer. Till now, I have been using the PHP API but decided to try the JS API for the ...
user avatar
0 votes
0 answers
19 views

Display posts ONLY from the current logged in user and current week/year/month Elementor posts

I want to show the posts my users have added in three different sections. That would be "Your Posts from This week" and so on. I am currently using: add_action( 'elementor/query/currentuser',...
user avatar
0 votes
0 answers
52 views

How to show ACF fields in Gridbuilder custom block

I'm using GridBuilder WP (great plugin, average support) to show a grid of a custom post type. Ultimately, I need to show an ACF taxonomy field, and their support have recommended using one of their ...
user avatar
  • 125
0 votes
0 answers
4 views

comment_notification_text filter not working

I want to customize notification for post author when comment is posted. My code in functions.php is : //add notifications when comment add_action( 'wp_insert_comment', 'wp_notify_postauthor' ); //...
user avatar
0 votes
1 answer
36 views

sortable columns for multiple custom post types not working

I have two custom post types named professor and campus. To each of these CPT's I have added two custom admin columns named image and last_modified, which currently display correctly on both CPT's ...
user avatar
  • 125
0 votes
0 answers
21 views

Line Breaks are stripped off when direction property is found

The line breaks are stripped off when the p tag has a dir attribute inserted, to explain further I'll list some examples. Let's say we have 2 lines of text as following <p>Text Paragraph Number ...
user avatar
0 votes
0 answers
12 views

How to optionally append components to the output of a gutenberg block?

I've been using block filters to update the core/embed block, and so far have added a couple of extra attributes and various controls to the edit method, but have stumbled on an issue when extending ...
user avatar
  • 206
1 vote
0 answers
24 views

How can I remove the kses filters when saving a specific post type ? (it breaks my JSON)

I want to store JSON in my post_content, but the kses filters makes it break. I would like to remove the kses filters when creating or updating (well, saving) a specific post type; anywhere in the ...
user avatar
  • 452
0 votes
1 answer
55 views

Use a hook or filter, or overwrite this Gamipress function?

Currently, Gamipress allows you to import a CSV file that lists a username (email or ID), and a points value to add to the points type for that user. It uses this function to achieve this, which ...
user avatar
  • 33
0 votes
1 answer
18 views

How do I add a line break to a string that is output by PHP?

There is a heading output in my ad statistics page (WordPress): <h3 id="ad-title"><?php printf( __( 'Statistics for %s', 'advanced-ads-tracking' ), $ad_name ); ?></h3> I ...
user avatar

1
2 3 4 5
59