All Questions
525 questions
0
votes
1
answer
55
views
Simple ajax request with Vanilla JS keeps given 400 Bad Request
I am new to Ajax and hope someone can help me with the following.
I am trying to make simple ajax test in wordpress, but getting al the time a 400 Bad request. I am really wondering why this is not ...
0
votes
1
answer
24
views
How to access a function declared in child theme's functions file in a plugin file?
I have a function declared in my child theme's functions.php file as seen below:
function test_fn(){
error_log("Test fn");
}
When I am calling this function in a plugin file, I am getting ...
0
votes
0
answers
14
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 ...
0
votes
1
answer
41
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 ...
1
vote
0
answers
77
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-...
0
votes
1
answer
89
views
stop resize button for wordpress media
The images in my WooCommerce product gallery do not need to be resized I only need the original image to display. Is there a way to add a toggle button to wordpress media to tell it to generate other ...
0
votes
0
answers
29
views
add to cart linking to add to cart page
I am making a website in Wordpress and created a custom shortcode for loading the products.
That is working fine, however when clicking the add the cart button, if redirects me to the cart page, where ...
0
votes
1
answer
26
views
How to call a logging function from a generic utility plugin from another plguin
I want to add some logging to my plugin, and for various reason want to create my own wrapper function around error_log(). And for reusability, I'd like to stick my wrapper function in a separate ...
1
vote
1
answer
96
views
How to get next day date of a specific day
I have created a shortcode in WordPress to show next day date of a specific day but it does not show the correct date when I am passing the parameter through the shortcode. Can anyone tell me what I ...
0
votes
1
answer
69
views
Mixed results with is_page() WordPress function, when using $this, or self
I'm converting an old plugin from PHP5 -> PHP8 and I came across this check, which caused an error when executing:
Notice: Accessing static property PropertySearch::$listing_details_template_name ...
0
votes
1
answer
27
views
CPU Overloading due to some hooks
I have some functions restricted in some hooks. The purpose of these hooks was to have consistent author name in the DB(which is a product attribute) and also update the display name. I placed this in ...
0
votes
1
answer
23
views
Read page- or post-content across different builder-plugins
I am currently working on a WordPress-plugin to analyse post- and page-content. The plugin contains a php-function that read the post- and page-content across several different builder-plugins (such ...
0
votes
0
answers
208
views
How to disable hover zoom on woocommerce. None of the common methods work
I have tried these codes in child functions and style files. Nothing works.
add_action( 'wp', 'divikingdom_disable_wc_zoom', 99 );
function divikingdom_disable_wc_zoom() {
remove_theme_support( '...
0
votes
0
answers
56
views
Import posts from a different database with the same old id
I am trying to retrieve data from an old custom programming to a new WordPress site, but I encountered a problem that I cannot retrieve the old id number. I need that to keep the site's archive, the ...
0
votes
0
answers
57
views
Why nested REPLY not working in WP Comments?
<section class="postcomments">
<div class="comlist">
<h3><span>—</span>Comments<span class="comcount"><?php echo ...
0
votes
1
answer
42
views
I want to allow certain file types on dokan upload files
Before we get started, I have tried alloweding "UPLOAD_UNFILTERED_FILES" thing on config.php and i have tried allow different mime type plugins, none of them worked
I want to allow .rbxlx, ....
0
votes
0
answers
86
views
Shortcode cannot parse attributes within double quotes. " is becoming ” breaking my shortcode
I made a plugin that creates a shortcode to calculate the time since a particular date in the past. It has two attributes, a date string and units:
function timesince_shortcode($atts) {
$atts = ...
0
votes
0
answers
51
views
Run a function only once when logging into dashboard
I want the Pro version of my plugin to do a version check once when an Administrator logs into the dashboard.
At the moment I am connecting to my API using wp_remote_get() in the main plugin file, but ...
0
votes
0
answers
58
views
Product customizing quiz - quiz adding products to the cart
Spend a lot of time on this and my client is getting angry but still no results…
Is there any plugin (or solution to use) you know to instantly add product to cart after giving specific answer on a ...
0
votes
0
answers
26
views
Wordpress Convert queries to slashes using function.php
Please check and explain why this wordpress rewrite rule isn't still working.
function myplugin_rewrite_rule() {
add_rewrite_rule( '^music/record-year/([^/]*)/?', 'music/?record_year=$matches[1]','...
0
votes
0
answers
21
views
How to change all the urls of the WordPress site?
We have created an online store with WordPress on a domain and now that we have finished testing, we must take it to the final domain.
I only need a method to change all the URLs of the site
I have ...
0
votes
0
answers
61
views
WordPress Custom Page Blog Template Pagination Problem (Pagination Not Displaying)
My website doesn't display pagination no matter what I do or try. Can you help me, please? Tried a lot of different codes and Plugins but no dice.
Here is the code for test template:
<?php
/* ...
0
votes
3
answers
842
views
wp_enqueue_script doesn't load JS in plugin
I wrote the following code in a standalone plugin, but it doesn't work
Please guide me how to modify the code, so the JS file is loaded.
<?php
/*
Plugin Name: Copy post
*/
class CopyPostApi{
...
0
votes
1
answer
187
views
Gravity Forms and Gravity View Permissions
I have a pretty direct question. I am trying to figure out how to programmatically prevent users from being able to view other users' form submissions. Currently, using Gravity View, any logged in ...
-1
votes
1
answer
58
views
Make plugin admin page visible to other roles
I have created a plugin that I want users with the role of 'Editor' to be able to see and use in their admin panel.Currently, only administrators can see and use this plugin.
I believe it has ...
-1
votes
1
answer
363
views
Option value not getting updated until page refresh in WordPress
I am building my WordPress plugin. There, at first I am using a checkbox, and then updating the value from the checkbox (yes or no) in the Database. Then, from later on I am fetching the value form ...
0
votes
0
answers
13
views
Selected dropdown option is not getting saved in the DB [duplicate]
I am building a function within my plugin where I have the list of available pages being displayed.
What I want is for whenever a user selects a page from the dropdown, it should save the slug of the ...
0
votes
1
answer
77
views
How can I save the selected page in the dropdown after anyone clicks on Save Changes?
I am trying to build a function for my plugin. Now, I am displaying the dropdown of all available pages. What I want is for when anyone chooses a page from there and clicks on Save Changes, the page ...
0
votes
1
answer
91
views
PHP Creating a formula from mysql db values and db stored math operator
I am trying to use variables stored in a DB and math operator (e.g. * + - /) to allow users to build formulas e.g. (Night Shift Hours*Night Shift Time Rate)*0.2
The formula string is build from ...
0
votes
1
answer
56
views
Create Wordpress category dynamically
I have more than 15 Category ,
And i have a custom taxonomy "classroom",
Is there any way to Create those categories automatically when i activate plugin?
0
votes
1
answer
296
views
auto activate plugin when theme is active
i have a class to activate the plugins when i set my theme to active but the class auto activate all plugins , how i can modify to activate only the plugins that i choose.
if ( ! class_exists( ...
0
votes
1
answer
221
views
Activate and deactivate two plugins automatically at certain hours
How I can Activate and deactivate two plugins automatically at certain hours?
For example,
I want the "akismet" plugin to be active only from 10am to 7pm and the other Times deactivated.
and
...
0
votes
0
answers
79
views
How can i call a functions.php function, from inside my plugin class?
I have a function get_finance() inside my functions.php file. It is used site wide and I don't want to move it.
In my plugin, I can call all the other functions inside my class or other included ...
0
votes
0
answers
25
views
Build a must-use plugin that tracks when other plugins are activated or deactivated
Here I am trying to utilize add_action to add a callback function to the hooked action of 'deactivate_plugin', but my function is not echoing as I expect.
$plugin = 'polls_plugin';<br>
function ...
0
votes
0
answers
318
views
Dynamic URL Rewrite for Custom
I have a custom post type called Hotels which I woud like to link to using the below url structure:
/{country}/{state}/{hotel-name}
I am fetching and inserting posts dynamically, so I do not know the ...
0
votes
2
answers
76
views
Cannot get wpdb data (Error in a simple fuction) [closed]
I'm using Cryto Plugin and want to get coin price data from plugin db.
For easy practice, I'm trying to get BTC data.
<?php function get_coin_price($coin_symbol) {
global $wpdb;
$coin_price = ...
0
votes
0
answers
31
views
How to make WooCommerce payment method field optional?
Here is my current code on a plugin.
/**
* Field Validation.
*/
public function payment_process() {
if ( 'woo_bkash' !== $_POST['payment_method'] ) {
return;
...
1
vote
2
answers
604
views
Scope for PHP Variables Assigned in functions.php or a plugin
I'm a web developer who works on WordPress sites and want to ensure I keep PHP variables out of the global scope. I have questions about this:
If I created a $new_title = "test seo title"; ...
0
votes
1
answer
213
views
Checkbox show / hide output result
How can i fix a show / hide function in my plugin.
The checkbox called "snup_check" at line 257 should be standard unchecked.
If the checkbox is unchecked nothing should happens.
If the ...
0
votes
1
answer
47
views
What is @Action in Wordpress?
I have found this code snippet on a plugin.
/** * @Action(name="workforce_content_loop_before", priority=10) */
public static function show_breadcrumb() {
echo do_shortcode( '[...
1
vote
0
answers
189
views
Load CSS before Theme CSS
I have a stylesheet I want to load first in the head before other plugins load css or theme css. For some reason priority is not working for me. Any idea how I can achieve this? I need to use ...
0
votes
1
answer
173
views
Custom Logo Link WordPress
I am trying to change the logo link of my wordpress website. But I am unable to achieve it. I am using child theme and using the code.
function crunchify_custom_logo_url ( $crunchify_logo_html ) {
...
2
votes
1
answer
176
views
Using a function to change favorites listing
Sorry - total newbie here with Wordpress development.
I have the following plugin installed https://favoriteposts.com/ and it allows you to change the default output of the users favorites by using ...
0
votes
1
answer
73
views
Wordpress Custom Hook with Class method
The code described below works normally outside of wordpress, but in wordpress I get "warning expects parameter 1 to be valid callback function mycars ($ mycarsclass) not found". If I remove ...
0
votes
1
answer
113
views
How to get current cart values using WC_Shortcodes?
I am trying to get current cart items from my own plugin using WC_Shortcodes::cart(); this will return cart details in html format.
WC()->cart->get_cart();
code not working. i need only cart ...
0
votes
0
answers
118
views
Error using wordpress functions inside a plugin class
Hy! In my plugin activation class i used wordpress functions (get_user_meta, update_user_meta)
<?php
/*
Plugin Name: Integração Pagarme Dokan
Description: Integrar os plugins pagarme para ...
0
votes
1
answer
61
views
Attempting to list all product categories and the price range of all products within them
I'm trying to display a list of all product categories and the price range of the products within those categories.
E.g
Headwear – £30-£150
Shoes – £35-£300
Where "Headwear" is the Product ...
1
vote
1
answer
146
views
Display post lists in 2nd paragraph
Hello great WordPress developers, I would like to list posts from a specif category in the 2nd or middle paragraph of the post.
I tried adding some scripts to my function.php to achieve that, but I ...
0
votes
1
answer
402
views
WP Function does not trigger on Webhook API Call
I have created a function that triggers and connect parent post with Child post based on a Custom Meta Field value. If Meta field value of an existing Parent post matches with the newly created child ...
0
votes
0
answers
194
views
Why do I need to reload the page for WordPress to see the new custom field added with jQuery
I added custom meta boxes and dynamically add an image loader button to it. The first image uploader works fine, it is generated by php. But, if I add a new row with an image loader button, then ...