Skip to main content

Questions tagged [functions]

A function is a sequence of program instructions that perform a specific task. It is packaged as a unit that can be used wherever the according task should be performed.

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

I need some help. I am creating a wordpress site for a school project and the captcha isn't visible

i am trying to add wp-recaptcha in a wordpress site. I have the correct keys and checked the fields i want captcha to display, but it's not visible. I have tried different plugins or use those plugins ...
0 votes
0 answers
10 views

Frontend WPBakery Page Builder unable to save the changes [closed]

Yesterday, I disabled and hid WP-JSON from public browsing using this suggestion, and it worked. However, when I tried to edit a page using the Frontend WPBakery Page Builder, it wouldn't let me save ...
oppa_'s user avatar
  • 1
0 votes
0 answers
8 views

Remove posts that start with similar words (like a delete duplicate posts plugin)

Can anyone advise on a SQL query or plugin (or any other solution, as I haven't been able to find any) that can delete all posts that start with the same words, except the oldest of them? Or maybe to ...
Johnny Bravo's user avatar
0 votes
0 answers
20 views

Put ACF function output code the_terms

I would like to put an ACF field in the of my the_terms function, is this possible? Because I can't figure out how to put it. <?php $dev = get_field ('my_field', 'option');?> <?php ...
user avatar
0 votes
1 answer
22 views

is there a list of actions on Wordpress

Often, I see a lot of useful functions under "add_action" for example "plugins_loaded", "admin_init", "show_user_profile", etc. Is there a website or similar ...
Rodrigo Moya's user avatar
0 votes
1 answer
14 views

Processing data and redirecting with query string

I am a WordPress and PHP newbie, or at least I haven't coded any PHP since PHP 5 (about 12 years). Our site needs a custom thank you page with a form embedded. I have done all the research I can and ...
pacmaninbw's user avatar
0 votes
0 answers
12 views

Add URL parameter to nav links based on domain

I use a suite of third party platforms and want to automatically add a ?source=web-nav parameter based on the link's domain. Is it possible to do this via functions.php?
Wildcat0927's user avatar
0 votes
0 answers
12 views

Need help adding currency conversion to this code

I found some code here: https://wisdmlabs.com/blog/woocommerce-set-minimum-cart-amount-user-role/ that prevents wholesale customers from putting in an order unless they satisfy a minimum cart amount. ...
Mr. Victor's user avatar
0 votes
0 answers
25 views

list all gutenberg blocks properties with icon name as well

function custom_blocks_api_get_blocks() { $blocks = WP_Block_Type_Registry::get_instance()->get_all_registered(); $block_data = array_map(function ($block) { return [ '...
Marko Krstic's user avatar
0 votes
1 answer
45 views

How to use a function inside of a function, or rewrite this code to work:

I have a script that works as a standalone php file, but if I put it in a Wordpress hook action with a function, the checkposts() function stops working. I tried to put the checkposts function outside ...
Peter's user avatar
  • 153
0 votes
1 answer
63 views

How to automatically flush permalinks?

Is it possible to write function that will trigger flush_rewrite_rules() on a timer? I would like for it to run every hour
John Saputo's user avatar
0 votes
0 answers
16 views

Advanced Custom Fields in WP_Query: Clickable Text in List Format

So I have two ACF fields. A text field author_name and an url field author_link. The url field is intended to wrap around the text field to make the links clickable. The staff member would enter this ...
Hex1189's user avatar
0 votes
0 answers
25 views

I got this error POST https://localhost/meraboilerwp/[object%20Object] 404 (Not Found)

//this is my functions.php // Enqueue Styles function meraboiler_enqueue_styles() { wp_enqueue_style('google-fonts', 'https://fonts.googleapis.com/css2?family=Patua+One&family=Open+Sans:wght@...
Kashkumar Singh's user avatar
0 votes
0 answers
35 views

How can I display a Divi content inside a modal based on an AJAX request

This is my first question, please bear with me if I have forgotten any information. I want to show Divi content (saved as a WordPress project if it's important) inside an overlayed modal. For this I ...
cho's user avatar
  • 1
0 votes
2 answers
36 views

I am looking for a function to create category links in the wordpress loop for articles

For several days I have been trying to create a link for the categories, basically they are displayed but are not clickable to access the categories page. Do you have a solution or a function to put ...
gestionlydie-tv's user avatar
0 votes
1 answer
77 views

Calling a function via a shortcode in javascript

I'm looking to dynamically change the page-comments option based on whether the user clicks a URL. I have two functions to do this: function psb_comment_listener_func(){ echo " <...
pbee's user avatar
  • 5
0 votes
0 answers
16 views

How do I make a shortcode to display Dokan seller badge list?

I am going to add the Dokan seller badge list to the single product page by creating a shortcode so that the tooltip is also displayed. Thank you for your guidance.
negar file's user avatar
0 votes
1 answer
41 views

Adding a css class to the gallery

I'm using WordPress 6.5 with the old editor, I'm trying to add a CSS class on the div gallery when it specified in the shortcode, the code doesn't work, can you help me ? function custom_gallery_class(...
Barrista's user avatar
0 votes
0 answers
35 views

Abbreviate Wordpress post view numbers

Can anyone please walk me through how to make post views on Wordpress shorten to 10K or 1.1M rather than displaying the full number 10,000 or 1,000,000. I found the code below but not sure how to ...
Steve's user avatar
  • 1
1 vote
2 answers
122 views

Image alt tag is showing post title instead of Alt Text

The image alt tag shows the post title in the source instead of the Alt Text. function my_custom_image_sizes() { add_image_size('homepage-thumb', 329, 185, true); } add_action('after_setup_theme', ...
rudyards's user avatar
0 votes
0 answers
32 views

Failed to open stream: No such file or directory in /home/search/public_html/wp-includes/functions.php on line 6852

Warning: file_get_contents(/home/search/public_html/wp-content/plugins/open-user-map/open-user-map.php): Failed to open stream: No such file or directory in /home/search/public_html/wp-includes/...
Jan's user avatar
  • 1
0 votes
0 answers
15 views

WordPress current post functions inside loop doesn't work anymore, are they incompatible with php 8.0?

I recently update php from 7.4 to 8.0 , since many functions doesn't work anymore ! I don't know if it's related but I have tried many solutions and none of them works. Using (get_...) , the_title, ...
imagIne's user avatar
  • 83
2 votes
2 answers
444 views

Remove or disable Appearance > Patterns

Not sure quite when, but a recent WordPress release has added a new WP Admin link under Appearance for Patterns: My themes don't use Gutenberg, and I've disabled it. But the Patterns screen is still ...
doofusb0y's user avatar
0 votes
0 answers
16 views

How Do I Prevent Featured Image Caption Displaying Above And Below Image

I'm trying to add an image caption below my featured image on my single posts. I have this working, but weirdly they are also displaying above the image. I'm hoping someone can help point out the ...
Nick Rowe's user avatar
0 votes
1 answer
22 views

comments_template() doesn't work with ajax call

I want to load comments by ajax. I can't call comment_template() functions using an ajax request. I don't want create a new query because I'll lost all inherited args (like all settings option in the ...
Stefano's user avatar
  • 33
0 votes
1 answer
118 views

ENV for Wordpress

Hi im new to wordpress/php so apology in advance for such a noob question. Just a little bit of context, I'm trying to do this custom stripe payment integration on a wordpress site that does something ...
darth-dev-vader's user avatar
0 votes
1 answer
61 views

Including product categories (product_cat taxonomy) title and description in search query

WHAT I'M TRYING TO DO I'm using woocommerce, but the question could work for WP categories also. When searching for a product, the search engine only looks for products info (title and description) ...
allumette's user avatar
2 votes
1 answer
35 views

Calling a PHP function from a menu item

Please forgive this totally newb question. I'm not a dev, and I'm a little too far that I can deal with right now... I'd like to add a link to the WooCommerce cart page using the cart icon from my ...
Patrick's user avatar
  • 21
1 vote
1 answer
38 views

Options of select field in a custom divi module ignore sorting

I made a little custom module for the Divi Builder which allows me to display a specific single post (from a custom post type). This works fine, but the options are not sorted correctly in the builder,...
Comaris's user avatar
  • 11
1 vote
0 answers
25 views

Custom update for Woocommerce stock quantity [closed]

In my Wordpress store, products are set as simple, but I use WS Form to add attributes to the product/order. We sell travels packages. When a user purchase a product, the quantity decrease to 1. But ...
Paolo Montalto's user avatar
0 votes
0 answers
37 views

get last part of page url and add it as cat in wp_query

I have a page URL : https://mwallpaper.ir/mobile-wallpapers/birds and I grabbed last part of URL with this filter : add_filter( 'example_filter', 'catslug_callback' ); function catslug_callback( $...
ehsan's user avatar
  • 13
1 vote
0 answers
18 views

How can I restrict comments on Wordpress, so only the POST AUTHOR and the user who commented can see them?

I'm after a way to hide / restrict FRONTEND comments on Wordpress posts, so that only the post Author can see them, as well as the user who posted the comment? Eg - Bob creates a post, and Sally, ...
Andy Moore's user avatar
1 vote
0 answers
25 views

Trying to insert widget code into theme function

The site I am working on has a function in the theme (Botiga) that creates a wrapper row that displays a sorting dropdown for the items below. The default output is the dropdown displays in the right ...
semidivine's user avatar
0 votes
0 answers
14 views

How to get the proper category in permalink with custom post type assigned to multiple categories

I was wondering if you could help me with the following issue. I have read a lot of cases, but couldn't trace anywhere good answer which explain, how this works. I created a custom post type: project ...
Brango's user avatar
  • 1
0 votes
1 answer
25 views

Redirecting after login except for a specific page

I needed to redirect users after login and this was not a problem using an add_filter on functions.php, done, it works as expected. But now I need to avoid this redirect when the user login from a ...
zatarra's user avatar
0 votes
1 answer
45 views

Simple way to make most of my site private

I need to make a site I am developing be mostly private, accessible by standard Wordpress login. Most plugins are way overkill for what I need, I don't need user roles, tiers, monetization etc. I just ...
semidivine's user avatar
1 vote
1 answer
10 views

Get check box values inside array for use in posting form data

So I have the following function with an array of variables that handles a profile form. All but one is a typical input with the exception of 'member-comptency[]'. It's a select field field with ...
visyoual's user avatar
  • 111
0 votes
1 answer
39 views

Secure way to add JS Script to Wordpress filesystem

EDIT: Because of the answers below i changed the title and explanation for this question. Maybe there are other people who struggle with saftey questions, like me. I am a beginner with Wordpress ...
LovinQuaQua's user avatar
0 votes
1 answer
86 views

Proper way to load styles using a child theme

I decided to start using Elementor Hello theme for building my websites. In the past, I always edited style, templates and other theme files directly from the original theme directory, but I decided ...
Martin Peternel's user avatar
0 votes
0 answers
11 views

How can I eliminate the top-level URL slug in WordPress while still being able to access child pages, particularly three levels deep or more?

Is this a limitation inherent to WordPress? For instance, when we have a URL structure with three levels of hierarchy, is it not possible to remove the first level? Currently, I must maintain the ...
Sankar V's user avatar
  • 101
1 vote
0 answers
38 views

Include bbPress topics and replies in WordPress search results?

I realize this deals with a plugin (bbPress) however I hope it's still considered relevant enough to WPSE since it deals with altering WordPress search results... How can I ensure that bbPress topics ...
Jesse Nickles's user avatar
0 votes
0 answers
12 views

Function for Post Creation plugin for Gravity Forms

add_action('gform_after_submission_33', 'customize_submission_values_for_custom_post_type', 10, 2); function customize_submission_values_for_custom_post_type($entry, $form) { if ($form['id'] != ...
JoaMika's user avatar
  • 688
1 vote
1 answer
107 views

Add custom text before all image captions in WordPress posts

I add captions to images in WordPress using the "Caption" box to indicate the photographer's name. I need custom text to always be displayed before the image caption, That is, now I just ...
Jusper's user avatar
  • 11
0 votes
0 answers
19 views

How to access admin menu labels and links on front-end?

I am trying to retrieve a list of all the admin menu labels and links on the front-end so I can add them to my admin bar menu. I don't need the submenus. I was hoping to access global $menu, but it ...
Aristocles's user avatar
0 votes
2 answers
20 views

Apply function only for specific post

I have a function to change the locale of the posts function change_og_locale( $locale ) { return 'es_ES'; } add_filter( 'wpseo_locale', 'change_og_locale' ); Now, I would like to fire it only if ...
NicoCaldo's user avatar
  • 147
0 votes
0 answers
112 views

Submit CF7 form programmatically with WP-Cron?

We need to check daily if our CF7 form is working properly (form submission data arrives to support's email). So i need a way to programmatically submit the form on frontend. I tried with WP-Cron but ...
Ion T's user avatar
  • 25
0 votes
0 answers
36 views

Get current post type within functions.php

In my function.php I need to run something to check post type or page id. how can i check current post type loaded in functions.php function.php <?php // the ajax function add_action('...
Beep's user avatar
  • 29
0 votes
1 answer
14 views

BuddyPress Edit activity function good practice

I am using a custom BuddyPress edit function. However, I was told this is a bad practice and that I should use WordPress's helper function. How to correctly do this? Here, is the code: add_action('...
Rohit kc's user avatar
1 vote
0 answers
54 views

Possible to overwrite load_template function in plugin using functions.php

So, I am currently using a Wholesale plugin for Woocommerce which, by default, redirects users to it’s own Wholesale Store page. The caveat is that the Wholesale Store page only uses the archive-...
jayciemota's user avatar
0 votes
0 answers
32 views

Include posts under a custom taxonomy in author.php

The author’s archive (author.php) on the website I’m working on displays only the posts by the current author. I have a custom taxonomy called “co_writer” which I use to simply tag a post as having ...
Sum's user avatar
  • 11

1
2 3 4 5
116