Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [filters]

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

0
votes
0answers
7 views

How to disable sub menu items from being created?

In WordPress under Appearance > Menus there is the visual menu builder where you can "indent" items to make them sub items of another menu item. I would like to disable the ability to make items sub ...
1
vote
1answer
8 views

Highlight “Show all” item in wp_list_categories

I use wp_list_categories to display category filters on post archives. I can use current_category param to set current category - and such item will get addition class current-cat. I can even omit ...
0
votes
0answers
19 views

show_count in wp_dropdown_categories not counting draft posts

I'm using wp_dropdown_categories in the restrict_manage_posts hook to build a filter for the various post_formats. It works correctly, but it seems to only be counting published posts, and won't ...
0
votes
0answers
17 views

Modify WordPress search behaviour in backend?

Is it somehow possible in WordPress to modify the default search in backend? At the moment I can only search when I start with the beginning of the search term. But I want to search with the second ...
0
votes
1answer
21 views

Posts as filtered list - expandable

I would love to achieve something like on Miranda July's Website for my architecture firm website. Very unsure where to start. Does anyone know a theme that has similar functionality, which I could ...
0
votes
0answers
20 views

long-title posts do not want published

long title posts do not want published, when I click on published (not function) always on draft. For example: The title 'Le général sorti un badge et se dirigea vers l’une des portes entourées de ...
0
votes
0answers
9 views

Woocommerce in-stock only with product filter

I have a function that is pulling only in-stock items in Woocommerce. It's working properly but I need to be able to sort them alphabetically and then also have a dropdown filter so customers can ...
0
votes
2answers
15 views

How to call a function or method that is Namespaced using another plugin

I'm using an action from one plugin that needs to call a function from another plugin. That function is name spaced. Typically, I would use something like: add_action( 'hook_name', 'function_name' );...
0
votes
0answers
28 views

Is there a way to disable ajax add to cart for specific products on single product pages

I would like to disable ajax add to cart for specific products, products that have add on's enabled by the Woocommerce product add on plugin as ajax add to cart is not compatible with products using ...
-1
votes
1answer
18 views

Auto append text after the title?

Original Title -> Original Title - Lorem ipsum How can I do this with hard code? I want this to stop people that web scrape my web without giving credit and making money off my posts from their ads ...
0
votes
1answer
20 views

Order by custom table and multiplication

I want to order posts by multiplying values from a custom table. +---------+------+------+------+------+------+ | post_id | a | b | c | d | e | +---------+------+------+------+------+--...
0
votes
0answers
16 views

WordPress Plugin Boilerplate - add actions and/or filters based on user's role

I am developing a plugin using WordPress Plugin Boilerplate. Some of its functionality need to be available only when a shortcode gets resolved in a page and furthermore some of it only if a user is ...
0
votes
1answer
23 views

use apply_filters return taxonomies custom post type

I reused the following code where a specific taxonomy is registered: public static function get_taxonomies_to_register() { $taxonomies = apply_filters( 'wp_taxonomies', array( 'wp_course'...
1
vote
1answer
13 views

Change username before login

How to change username before submitting in login form ? I have used mobile number as username when a user registers in site. also I have removed 0 from the beginning of the mobile number. Now in ...
0
votes
1answer
13 views

Query Posts | Combining multiple form inputs into query arguments to generate one filter result

I am trying and so far failing to take two form inputs and combine them into a single post query. I have tested these forms as two separate forms and both return results as expected, I am now trying ...
0
votes
0answers
9 views

Shortcode inside another shortcode / Post page to Woocommerce

Good morning, I made a shortcode [block id="tt2"] in a post, which included another shortcode to insert php in brackets [insert_php] phpcode [/ insert_php] but then, when inserting the first shortcode ...
0
votes
0answers
46 views

Filter parent_file doesn't working

I am trying to highlight an admin menu option (top level or submenu) but it just doesn't work. The code should be pretty straight forward but it seems that my filter isn't triggered. add_filter('...
1
vote
1answer
49 views

Remove the first 5 characters of the_title and orderby that

I have a custom post type where all titles are dates (in this format: YYYY-MM-DD). I need to order them by month then day, but not at all by year. So I imagine I need a filter to 'look' 5 characters ...
1
vote
0answers
9 views

How to add custom classes to figure element only if image has caption?

I want to add the 'wp-caption' class to the figure element only if the image has caption. How do I do that? I'm using the new gutenberg enviroment, if that affects anything. for example: form this: ...
1
vote
1answer
25 views

Remove a div from RSS feed

If someone can help to remove a div from my RSS feed. I want to remove below code from my RSS feed. <div class="well"> <a class="btn" href="foo.com">foo</a></div> Thanks in ...
1
vote
0answers
13 views

How to prepare WordPress Rest data for Preview Changes?

I am currently building a custom theme by using WordPress Rest API, ACF and Vuejs. I am able to delete some data for published pages/posts using rest_prepare_page filter and rest_prepare_post filter....
0
votes
0answers
12 views

WP Job Manager target create_account_email field placeholder text [closed]

I have WP Job Manager and notice if I go to post a job without an account it sets two added fields of Username and Email at the top of the standard job form form#submit-job-form.job-manager-form to ...
1
vote
0answers
60 views

How can I extend the Gutenberg table block transform to allow colspans/rowspans on pasted table <td> elements?

I'm trying to allow users to paste (relatively) simple tables into Gutenberg. The editor converts the raw HTML fine but strips out any attributes/classes. For the most part this is good - I want to ...
0
votes
1answer
26 views

How to add custom li item to wordpress menu

I have tried to add custom li to my wordpress header menu using functions.php. Here is my code in function file. function register_header_menu() { register_nav_menu('header-menu',__( 'Header Menu' ...
0
votes
0answers
16 views

CPT, taxonomy logic and filter

This is more a question on how to attack a problem. And my 1st one also. I’ve added a custom post type – Projects – that has a custom taxonomy – Group. Is it possible to separate the behavior (render)...
0
votes
0answers
11 views

Where put an ajax message like “working…” in the CPT list?

I have a CPT list in the admin area with ajax functions for change the status of the post checking or uncheking a checkbox. All seems to be allright, but I like to fire a message like "working.." ...
0
votes
1answer
11 views

Prevent function from triggering on current page

I created a list of posts, each post about a car model. After that, I created a post about the best car models. This post grabs each post about every car model and displays them in a snippet list ...
0
votes
1answer
15 views

how to develop a filter in wordpress to let the user filter the page content depends on the date (newest to oldest etc…)?

how to develop a filter in WordPress to let the user sort the page content depends on (alphabetically, newest to oldest and oldest to newest etc...)? I’d like another drop down tab on the left side ...
0
votes
0answers
15 views

Filtering Date from JSON Snippet Output in PHP

Been struggling for two days now, please help. WP Product Review Lite generates Schema through JSON code. The code is constructed through the class 'WPPR_Review_Model' with a function called '...
0
votes
1answer
36 views

How can I output all apply_filters and do_action?

I would like to output all apply_filters and do_action to give the user an overview of them. If I use the Code add_filter( 'wpErpOs_testFilter', 'wpErpOs_testFilter_callback', 10, 1 ); function ...
0
votes
0answers
23 views

How to clear billing fields and set defaults in WooCommerce [closed]

I set default values for my billing fields in WooCommerce like so: add_filter('woocommerce_checkout_fields' , 'checkout_field_defaults'); function checkout_field_defaults($fields) { $fields['...
0
votes
0answers
20 views

PHP Category Filter

I am very very (very) new to all of this and have a project in seminar I'm doing. Now, the task is to add lines of code to .php file to create one more filter field to this site - https://www....
0
votes
1answer
24 views

Assign IDs to headings in ACF using functions.php

I'm assigning IDs to each heading on my Wordpress site. It works fine for pages where I don't use ACF with the following code snippet in functions.php function auto_id_headings( $content ) { $...
0
votes
1answer
22 views

Getting the terms from “Beautiful Taxonomy Filters” Results ot Integrate into “Ajax Load More”

I’m trying to get BTF integrated with the Ajax Load More plugin and am having trouble on the filter results that are using two differen t taxonomies. Basically I just need to know how to query/call ...
0
votes
1answer
20 views

Print only parent categories of post in custom RSS feed

I'm trying to print only the parent category for each post and a permalink to that category within a custom Wordpress RSS feed. Using <?php the_category_rss(); ?> prints all categories for a ...
0
votes
1answer
31 views

How to elect position of new item output in a dropdown when using add_filter

Hello I am using the suggested snippet here to add a new term to a dropdown menu: https://wpjobmanager.com/document/applications-customising-application-statuses/ which is: add_filter( '...
2
votes
2answers
167 views

How to replace any occurence of Gravatars with a local placeholder image?

Users can upload an avatar as a local image file on my website. If they didn't do so, it will fall back to the WordPress default (Gravatar). But I want any occurrence of Gravatar to be replaced with a ...
0
votes
0answers
17 views

How to change text in Password protected Page using add_filter function

I want to change text in my theme .po file. I found this function named filter hook and I included it into my functions.php in my theme. https://codex.wordpress.org/Using_Password_Protection#...
0
votes
1answer
86 views

Allow EPS file upload - two EPS files have different MIME types

I got this error message when trying to upload EPS-files to my WordPress Media Library: Sorry, this file type is not permitted for security reasons So I added this snippet to my functions.php ...
0
votes
1answer
30 views

How to always display a specific post from the search result first

I created a search filter that displays posts randomly, and I wonder how can I always display a specific post item in the first position of the search results and display the rest of the items ...
1
vote
2answers
14 views

Print last modified date only on posts

I'm printing the last modified date via functions.php with the following code function wpb_last_updated_date( $content ) { $u_time = get_the_time('U'); $u_modified_time = ...
0
votes
1answer
20 views

How to take shortcode and content separately from a page?

I have a page with content and shortcode for the contact form. I want to display the content of the page in one div and the shortcode in another div(that means the form should render in another div). ...
0
votes
2answers
45 views

Re-order search results with posts_orderby filter and post meta value

I'd like to re-order the search results based on post meta and date . The post meta key is _prioritize_s and the value isn't important. So in a "normal" meta query, I'd just write the compare ...
0
votes
0answers
13 views

search and filter with custom post type and custom fields

I want to put a filter system in my website that contain a search input and list of states, if I choose a state without writing in input it'll give me all posts in that state and if I search for ...
0
votes
0answers
15 views

Modifying Woocommerce menu based on tags and categories

I am currently trying to modify/customize a primary menu on Woocommerce. The products ghave tags X and are categorized in categories Y. I’d like to have a way to filter products on Woocommerce ...
2
votes
2answers
122 views

Changing text within the Block Editor

Question: how can I change text within the Block Editor itself? When a user with edit but not publish permissions makes changes to a published post and clicks "submit for review," the Block Editor ...
1
vote
2answers
29 views

Adding HTML to the end of every post with the Block Editor

I'm converting my posts over to use the new Block Editor. In the past I added an icon to the end of every post to act as a signature and marker saying the article is over (like print magazines do). I ...
1
vote
1answer
18 views

How to hide Ads in between posts on AMP? [closed]

I am using the following code to show ads on my posts after Para 4:- add_filter( 'the_content', 'prefix_insert_post_ads' ); function prefix_insert_post_ads( $content ) { $ad_code = My Ad code; ...
0
votes
0answers
18 views

WordPress Tag Cloud Filter Prevents Widget HTML from loading

I have a sidebar in wordpress registered like this: register_sidebar( array( 'name' => 'Blog Sidebar', 'id' => 'blog_sidebar', 'before_widget' => '<div ...
0
votes
1answer
21 views

Security question - Display a General Custom Login Error Message

I need to change the information given on Wordpress' Login page and the Lost password page so that hackers cannot easily see if a username or email is associated with an existing account. At the ...