Questions tagged [filters]

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

Filter by
Sorted by
Tagged with
0 votes
0 answers
37 views

Display featured posts first, then display all others within a specific category in WordPress

I want to display featured posts first, then all other posts not marked as featured on a category archive page. I am using a plugin that has functionality to mark posts as featured. I have figured out ...
user1462's user avatar
  • 1,274
0 votes
1 answer
19 views

hook on the_excerpt

I would like to have the excerpt length formatted + [...] and then keeping the 'read-more' as a button. I was able to hook the 'excerpt_length' from 55 to 25 and that was fine: function ...
made leod's user avatar
-1 votes
0 answers
11 views

I want students to be able to insert Mathematical notation for answer to QSM plugin question

I am creating a quiz using QSM plugin on wordpress. I have mathjax also loaded. I can i set you quiz so students can input Mathematical notation in their answers.
Raj's user avatar
  • 1
0 votes
0 answers
10 views

Filtering by Hard-coded WooCommerce Product Attributes

I searched everything and couldn't find an issue related to my problem. Most of our product attributes are hard coded in a way that they don't exist in Products->Attributes but are directly created ...
Nikola Donev's user avatar
0 votes
0 answers
16 views

Edit password change email text or disable it

I have a function in my custom plugin that will be called after the user do the fisrt login. The function, after a check will give to the user the ability to change it's assigned password with a ...
ICTDEV's user avatar
  • 113
0 votes
0 answers
20 views

Using send_password_email filter after wp_update_user

I have created a custom plugin that will provide some custom user roles that are named customers and operators. When an user will create a new account, I've created some logics that imply that ...
ICTDEV's user avatar
  • 113
0 votes
0 answers
18 views

Deactivate code made with add_filter

In WordPress I have a calendar (With the "Events Calendar Plugin"). I want this calendar to be for logged in users only. So I used this code: add_filter( 'tribe_events_pre_get_posts', '...
Haya's user avatar
  • 1
0 votes
0 answers
13 views

Why wordpress doesn't allow to add author filter to media library page in grid mode

It appears that Wordpress doesn't allow to apply new author filter to upload page (upload.php) in "grid" mode. If it's right, why? If not, does it exist a specific hook/function to allow ...
imagIne's user avatar
  • 41
0 votes
1 answer
17 views

Adding Author Filter to CPTs

I'm trying to add an author filter to the WP Admin pages for the CPTs 'booking' and 'ticket' The code below works when using only one post type, but adding || and the second cpt stops it. I've tried ...
Blakar1988's user avatar
0 votes
0 answers
23 views

'Problem' with login_redirect filter - why does it lose the redirect_to parameter

This has kept me busy all day and I just want to clarify my understanding as this seems really bizarre behaviour if this is by design. I am redirecting the login according to roles by using the ...
mmacneill123's user avatar
0 votes
0 answers
23 views

How can I display formatted content using the_content filter?

I am using the_content filter to append comment summaries to posts on a blog page. That part of my code works. I am having a problem with the display of pages where they are not formatted and ...
bigmoxy's user avatar
0 votes
1 answer
22 views

add_filter - create_function pb in PHP8

I have difficulties to make this little code compliant with PHP 8 : add_filter('excerpt_more', create_function('', 'return "";') ); Any idea how to make it working?
Seal20's user avatar
  • 3
0 votes
1 answer
23 views

wp_head filter not executed inside custom class

I have this code in a simple plugin that is supposed to make wordpress unbranded: <?php /* * Class to remove wp-* branding from WordPress * @package users-manager.php */ class WpUnbrand { ...
ICTDEV's user avatar
  • 113
0 votes
1 answer
26 views

Replace image with its alt text?

I have a WordPress post with lots of inline HTML images. I want to output my HTML in such a way that the existing: <p>Here's my cat: <img src="example.jpg" alt="A photo of ...
Terence Eden's user avatar
0 votes
1 answer
23 views

I only want to show links to categories that have posts in 'publish' state in my menu

I am working on a WordPress project where I want to dynamically filter menu items (and possibly their parent items) based on whether they are associated with any published posts. Specifically, I am ...
CodingWeb's user avatar
  • 101
0 votes
1 answer
16 views

What is the best way to ignore wordpress administration using add_filter($title) also when Ajax request

Inside a custom plugin to translate Posts contents I use add_filter() and plugins_loaded() hook to replace all $title, $excerpt, $content, $postmeta. As the documentation says wp Ajax use admin_ajax....
imagIne's user avatar
  • 41
1 vote
0 answers
22 views

How to Filter the Custom term loop based on dropdown

I had created on Custom Post Type 'resource', which has 4 taxonomies ('type', 'sector', 'industry', 'rtag') now i had added 45 posts in following manners Type - Brochure, Infographic, Research Paper, ...
Bhargav Joshi's user avatar
0 votes
2 answers
99 views

How to load only a certain type of image (functions.php)

Can only images of a certain type be loaded from the media library in the customization panel? eg: png. I tried some types but it didn't work. $wp_customize->add_setting( 'themeslug_logo', array( ...
Josef Volný's user avatar
0 votes
0 answers
10 views

get available brand attribute in woo commerce shop page, category page

I used below code to display the brands in shop page, product category page's sidebar. function custom_register_brand_taxonomy() { $args = array( 'hierarchical' => true, 'label' ...
Shankar S Bavan's user avatar
0 votes
0 answers
9 views

Remove tab on product for one category, keep but change image for another

On our WooCommerce WordPress product page, I was able to remove the 'Additional Information; tab with the following code: add_filter( 'woocommerce_product_tabs', 'woo_remove_product_tabs', 98 ); ...
Spacejams's user avatar
0 votes
1 answer
63 views

Unable to logout correctly after wp-login file was modified

I'm using a custom url for the login of my WordPress site. I've added this code in my functions.php file /** Hide default login */ function hide_default_login() { //Only proceed for guests if ...
ICTDEV's user avatar
  • 113
0 votes
1 answer
116 views

How rename wp-content and wp-admin folders correctly

I've readed that using some constant defined into the wp-config.php file is possible to use a custom folder instead of the default wp-content. The same thing if I've understood can be applied also to ...
ICTDEV's user avatar
  • 113
0 votes
0 answers
11 views

filter hook 'authenticate' runs twice

I am writing a custom function for logging into wordpress multisite. I take the name of the site via blog_id and append it to the username then pass it into 'authenticate' filter hook. Eg) Username ...
Harish Prabhakar's user avatar
0 votes
0 answers
47 views

Unable to correctly logout after changed wp-login.php

I've followed a guide on internet that suggested how to change the wp-login.php page to something custom by modifing the wp-login.php file itself and by renaming it. I've copied the wp-login.php ...
ICTDEV's user avatar
  • 113
0 votes
1 answer
20 views

Is there a way to override only a portion of the function print_media_templates defined in wp-includes\media-template.php?

I'd just like to -safely- change the visual presentation on the Attachments pop-up window, ie. move some of the main DIVs around. But it seems like the only hook is to the entire function which is ...
jchwebdev's user avatar
  • 765
0 votes
1 answer
50 views

How could I create real-time filtering in this case?

I have a "Library" page within my website, in which there are several "templates". Each of these templates has a "Category" assigned to it. The difficulty is that I need ...
EDG_DGK's user avatar
0 votes
0 answers
9 views

How to do filtering option like this?

I'm developing a site for my client and he gave me this site for reference. I'm wondering if anybody can help me with how to do the filtering like this with a plugin. Thanks. https://entrepreneurs....
Tubai's user avatar
  • 1
0 votes
2 answers
31 views

Add function to single blog post pages only

I am wanting to add this code to single blog posts only after content. Right now it is showing up on every page after content. add_action( 'presscore_after_content', 'insert_cp_banner' ); function ...
nine19's user avatar
  • 1
0 votes
1 answer
50 views

How to filter products by category in custom loop

<form method="GET" class="filter-form"> <label>Select Category</label> <?php $terms = get_terms(array('taxonomy' => 'product_cat', 'orderby' =&...
byvex technology's user avatar
0 votes
1 answer
18 views

Grab IDs of products from WP_Query which is run elsewhere

In one of my template files, I am running the standard WP_Query and loop etc. This is not within the product archive etc, just a regular custom template. <?php $args = array( 'post_type' => '...
wharfdale's user avatar
  • 348
3 votes
1 answer
26 views

How can I change the post order after filtering in WordPress?

After filtering the post list in the admin dashboard, how can I change the order of posts after filtering and it will display in the same order at the front end too?
Radheeka Chopda's user avatar
0 votes
0 answers
35 views

remove filter added by plugin with anonymous function

Just for testing, I created a plugin with this add_filter( 'woocommerce_checkout_fields' , function( $fields ) { unset($fields['order']['order_comments']); return $fields; } ); Now, I would like to ...
Hung Pham's user avatar
0 votes
1 answer
60 views

Get field added via attachment_fields_to_edit filter in Gutenberg

In a plugin I'm building, I've added a field named attribution to attachments via the attachment_fields_to_edit filter. I'm trying to get this info in the block editor but when I output the variable ...
leemon's user avatar
  • 1,806
0 votes
0 answers
38 views

How can I filter the post using parent category and child category in admin list in Wordpress

I need to make the two dropdown 1. parent category and 2. Child category. When user select the parent category, only child of that category will be displayed in second dropdown and after selecting it, ...
Radheeka Chopda's user avatar
0 votes
1 answer
28 views

is_singular() in mu-plugins not working

I wanted to use mu-plugins to load the plugin only on a page with a single blog post. Unfortunately, the is_singular('post') function is not working properly. So I tried using $post->post_type, but ...
patryk siuta's user avatar
0 votes
0 answers
13 views

How to add "Leave a Comment" link or button at the bottom of each post in the "Latest Posts" block?

I have been digging around in WordPress developer resources to see if I can figure out how to add "Leave a Comment" link or button at the bottom of each post in the "Latest Posts" ...
bistromatic's user avatar
0 votes
0 answers
14 views

wp_query loop how to also display post second time with specific condition

I filtered posts by period : from "current week"* , from * + 1 (following 2nd week), from * + 1 + 2 (following 3rd and 4th week) and from 1st day of current month * 12 month. For the last ...
imagIne's user avatar
  • 41
0 votes
0 answers
37 views

nav_menu_css_class add_filter is never called

I try to use nav_menu_css_class filter with add_filter in worpress but it seems that it's not working ( i tried an echo or diein the function but never acces it). I just added a register_nav to add a ...
amir nadji's user avatar
0 votes
0 answers
320 views

How to use render_block filter in Gutenberg when editing a page?

I am trying to add new content after updating a page. I've tried the code below, which doesn't seem to have any effect. I've tried core/paragraph and core/code in the if statement below but still no ...
user1448031's user avatar
0 votes
0 answers
32 views

Ship block templates or block template parts with plugins

Using the following code one can ship CLASSIC PHP templates for custom post types registered in plugins. An example for a custom post type named MOVIE: function my_template_include( $template ) { ...
leemon's user avatar
  • 1,806
0 votes
1 answer
34 views

How to apply_filter / add_filter within 2 others (simultaneous?) add_filter

I'm setting up a new form tracking system for my website (the form framework is Gravity forms). The codebase consists in a parent theme, plus 3 child theme (one for the main website, one for the shop, ...
Enrico Cassinelli's user avatar
2 votes
1 answer
96 views

How do I query Pending posts?

When I query my posts, I can retrieve all PUBLISHED posts. For example: /wp-json/wp/v2/posts ?_fields=yoast_head_json, date,modified,link,title,author,comment_status,status &per_page=100 &...
Rob Hess's user avatar
0 votes
0 answers
76 views

WordPress REST API and Backbone JS

I am trying to learn WordPress Rest API using Backbone.js the official library, there aren't many tutorials, and that's why I am asking this question right here. First question is why when I add WP-...
Kristijan Pirkovic's user avatar
0 votes
1 answer
168 views

How to display title, description etc in block images?

I tried this code, but is not working, I just want to display the extra info from images when adding the block image. // Function to add title, caption, and description to wp-block-image function ...
Diana's user avatar
  • 1,238
0 votes
0 answers
43 views

How to add field new in account bacs in woocommerce?

i was looking for a way to add a new field to woocommerce bank account info, my theme has no child theme and i put my code in functions.php I found the solution but it doesn't work. function ...
Le Xuan Phat's user avatar
0 votes
1 answer
117 views

Add custom ID to WooCommerce product tab

I've created a custom product tab in my functions.php - it looks like this: add_filter( 'woocommerce_product_tabs', 'custom_description_tab' ); function custom_description_tab( $tabs ) { global $...
WPTricksDK's user avatar
0 votes
2 answers
186 views

Adding filter to the Contact Form 7 response

I have a Contact Form 7 that adds a new post when submitted. In the response text that displays after submitted, I would like to include a link to that post. add_action( 'wpcf7_before_send_mail', ...
Ofikatiramene's user avatar
0 votes
1 answer
60 views

Add text below WooCommerce short description if metabox value is true

For WooCommerce I have a custom metabox that sets products to unavailable if ticked. The code below removes the add to cart button if a product is set to unavailable: // Remove add to cart button if ...
Dvaeer's user avatar
  • 619
0 votes
2 answers
99 views

Is there a hook that I can use when a fatal error occurs?

Ideally I would like to log the user or page that triggers a fatal error so that I can follow up with that person or go directly to the page they were on for testing. My thought is that if there is an ...
Aristocles's user avatar
0 votes
0 answers
14 views

How to show posts with at least two categories (in admin)

I have a custom post type "cus_type" and and custom taxonomy (category) "cus_category", so that a cus_type can have one or more categories. In the post list in the admin (edit.php) ...
remy's user avatar
  • 1

1
2 3 4 5
60