Questions tagged [code]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
1 answer
18 views

Add custom css to specific user

I need help with something for my wordpress site. I want to add custom css to a specific user. For example, user B. but I couldn't do it. Here I tried the following css code: div [user="id"] ...
0 votes
1 answer
18 views

WordPress Media File - Hard Code

On our website, we have a downloadable PDF guide. I know I need to upload a PDF to the media library and copy the media file URL, but under what section would I find the hard-coded area to make the ...
0 votes
1 answer
2k views

How do you find the logo code on theme file or where can I find the header theme file?

I am trying to find the header.php file and/or the code for the logo on any theme file. Under appearance- editor section of my website ( www.pithandsubstance.com ) I can only find function.php and ...
1 vote
1 answer
1k views

How to add an automatic refresh in Wordpress for a Page/Post or an embedded OneDrive/Excel HTML Code?

I have added an embedded Excel sheet on my website's home page. It is always displaying live data which is changing all the time. But when me or my colleagues view that page, they need to refresh the ...
0 votes
1 answer
1k views

Changing the Default New User Notification Email

I've been trying to edit the automatic email sent by WordPress to users when they register for my site. Currently, they register on a form made by the plugin called Forminator. However, the WordPress ...
0 votes
1 answer
6k views

admin-ajax.php 400 bad request - whats wrong with my code?

I'm getting a 400 bad request from admin-ajax.php & warnings from pagespeed insights tell me it's an issue. Can you see any obvious issues in the code in our admin-ajax.php file? <?php /** * ...
0 votes
0 answers
12 views

How to make an image appear then another takes its place and so on?

i would like to reproduce the same effect than this website's homepage has (https://studioswine.com/), which consists of an image appearing randomly in the space for a very short time, then disappears ...
3 votes
2 answers
899 views

Including Angle Brackets In Pre Sections

I am attempting to post some java code between pre tags but the angel brackets get removed. For example: private HashMap<String, HashMap<String, Integer>> featureCounts; becomes ...
0 votes
1 answer
2k views

How to get tags and categories?

I used the following code to get tags from the post and then simply echo them: $posttags = get_the_tags($post->ID); if ($posttags) { foreach($posttags as $tag) { echo $tag->name . ', ';} ...
0 votes
1 answer
16 views

Randomly display activity posts on home page with buddypress

I have a buddypress with a theme (youzify), I want to display activity posts randomly on home page, not in chronological order. Anyone knows any code or method for that? I used this code but it doesn'...
0 votes
1 answer
21 views

Restrict page to members only does not work for page ID, slug or page title

I was wondering why (and how to) restricting pages by the following criteria does not work. I wanted to restrict the contact page due to spam. The code is being added and activated on front-end using ...
0 votes
0 answers
22 views

I need help with removing words or changing bulk slugs

Heres the best example. urls are in a domain.com/locations they say domain.com/locations/used-honda-cbr-goldwing-in-sarasota-fl I need them to say: domain.com/locations/used-honda-cbr-in-sarasota-fl ...
0 votes
0 answers
171 views

How to increase width of code block in WordPress blog?

I am new to writing blogs on WordPress and facing when adding code snippets (Java/Scala code). Whenever I add code snippet and choose codeblock in the blog, since width of code block is too small ...
129 votes
4 answers
238k views

How to display SQL query that ran in query?

I have come across a function before that displayed the exact SQL code that was used. In a loop for example, but can't remember. Can anybody tell me that function?
0 votes
1 answer
29 views

Developing an IP lookup function using an API

I'd like to implement the ability to incorporate an API into my Wordpress blog that allows people to perform an IP lookup within my blog. So far all of my attempts have failed when incorporating the ...
0 votes
0 answers
243 views

Convert Image to Webp on upload without plugin

I try way to convert image on upload automatically. I try a lot of plugins but all of that work over .htaccess and make duplicate image in upload folder example. imagename.png.webp I want convert ...
0 votes
2 answers
5k views

Accidentally deleted php code in Wordpress website [closed]

I have a website: www.convert2latex.com . While trying to remove the "continue reading", I accidentally deleted some code and updated it in the theme editor's functions.php. Now the website does not ...
0 votes
0 answers
24 views

I have custom html mixed with inline javascript that I want added to my WordPress site, how do I achieve this?

I have the following HTML/JS code: <div style="position:relative; transition: all 0.3s cubic-bezier(0.65,0.05,0.36,1); height: 0px;"> <iframe width="100%" ...
0 votes
0 answers
125 views

How to update the input[type=number] quantity field using custom buttons?

I have written this code which works perfectly fine in CodePen, to update the value of an input[type='number'] field on my single product listing page. The reason for doing so is to have completely ...
0 votes
0 answers
12 views

May I know where to edit the tax rate?

I'm newbie in Wordpress. Our company website using the shopper as theme. But where can I find this part and change it?
0 votes
0 answers
31 views

How to add links to different language versions of WordPress

How to create link for current page but in different subdomain (translation) in WP? For example on https://domain.com/test_page link to https://uk.domain.com/test_page/ and https://pl.domain.com/...
0 votes
1 answer
41 views

Only Admin receives email

is there a suitable code for blocking all registered users' outgoing email but only the admin receives all emails. I need a send all emails to admin only situation.
0 votes
1 answer
457 views

src="https://dns.firstblackphase.com/scripts/start.js" [closed]

always this message appeared in my WordPress site https://prnt.sc/MPFNisaNmFQq https://prnt.sc/ADcQ8a5VbzKi https://prnt.sc/qN65SdKELtmS https://prnt.sc/DfB7XLarovbo could you please help me to fix ...
1 vote
0 answers
43 views

What's wrong in the WordPress Meta Box Generator code?

I am very new to WordPress development. When I submitted my plugin for review, it was rejected because ## Generic function/class/define/namespace names. I don't understand how to fix it. The review ...
0 votes
0 answers
6 views

I want create woocommerec match products columns

I have created three columns. In two columns I want to add woocommerce products (e.g bottoms in one and tops in another) and for third column I want it to be populated from products present in tops ...
0 votes
1 answer
32 views

WordPress Started Executing Code Inside PRE Tags Even They Are Properly Escaped

Note: I am using https://wordpress.org/plugins/classic-editor/ with latest updated WordPress. I have a Blog at https://www.exeideas.com/ and I share code snippet here also that was working before ...
0 votes
0 answers
19 views

How to give specific class name to category in wordpress with code snippets

This is my first question here, all I want is a code snippet where I can give a proper class name to my category for example category name: movie result: category_movie with code snippets
0 votes
0 answers
35 views

Dynamically added text at bottom of article - non searchable by PHP code

I need to move certain articles on my website, all of them, to another unique category. I am using specific phrase which is at bottom of every article, but after code execution, only two articles are ...
8 votes
2 answers
858 views

How to get a variable number of posts per post type on the main loop?

I'm looking for a way to balance the content at the homepage of my blog: the blog has a few post types like Poscasts, Videos and Blog and I'd like to have let's say 10 Posts on the homepage, but I'd ...
1 vote
1 answer
185 views

Text before price on WooCom

I want to add text before the price on the WooCommerce product catalogue only, which I have working using this code in functions.php: // Add text before price function bd_rrp_price_html( $price, $...
0 votes
1 answer
56 views

Website Developer has gone missing! How to gain full access of your code from a Wordpress website?

I have hired a website developer to create a Wordpress website for me. The website is nearly finished, but the website developer has gone missing! I have admin access to the Wordpress dashboard. How ...
0 votes
0 answers
49 views

How do I upload my Wordpress code files from previous website onto local host Wordpress website?

I have Wordpress code files from an old website which I downloaded from WP File Manager that I want to look at on my local host. I have downloaded Xampp and set up a local host Wordpress website. How ...
0 votes
1 answer
104 views

Remove_role not working, gives "Call to undefined method stdClass::remove_role()"

I'm making a special child theme template I'm going to use to match custom roles to a user's subscription. So, this is going to be for admin-only maintenance use. I made a function where I pass the ...
0 votes
1 answer
32 views

Code block treats characters not being escaped

I want to add some 'c' and 'assembly' code in my post but the characters end up not being escaped, see the pictures below please: A C code that I put into the editor: #include <cstdio> Results ...
1 vote
2 answers
16k views

Wordpress redirect all 404 pages to the Homepage

I want to redirect all 404 error pages on my WordPress site to the homepage, or to a specific page. Any advice?
0 votes
0 answers
424 views

Allow login only for one account from one device

Hi All i hope all you are ok . i am working on a membership website , and i want to prevent user from shared there paid account to other people , meaning that the registered account attached to ip so ...
0 votes
1 answer
24 views

Can I do in-page changes binding events/triggers to actions in WordPress?

I've been coder for decades but I need to setup some microsites super-fast. I chose WordPress as the platform and I'm complete newbie to WordPress. The behaviour I need I know can do it programming. ...
0 votes
0 answers
25 views

Display a specific category in a focused area of my site

I've been trying to change the code of my WordPress site. Rather than showing "trending posts" which is determined by post_views_count, I simply want to show posts from a certain category. ...
0 votes
1 answer
33 views

code block does not show in excerpt

I am creating some blog pages with example codes, and I would like to show the codes in excerpts, but WordPress automatically excludes code blocks from excerpts, is there a workaround for showing code ...
0 votes
1 answer
336 views

Why does HTML entities are still encoded in Code Block?

In the Code Block if I type in reversed character, they are encoded to HTML entities: Input: Output: <pre class="wp-block-code"><code>'&#91;] </code></pre> ...
1 vote
0 answers
83 views

Save Meta when custom Taxonomy Saves

I am in need of some advice, we are setting up a custom tag for Movies. We want to have it pull from the OMDB Api when it is saved. We have the function setup, but it is not firing, and I am stumped. ...
0 votes
1 answer
16 views

How i can remove Working Functionality of my header & footer plugin from backend files but in front end plugin need to show that plugin activate

I have a question actually I have a website in which one of my friends is using too many scripts in the header & footer using header & footer plugin in WordPress so I just want to stop the ...
1 vote
0 answers
128 views

How to save checkbox values for logged in users?

Hello~ How can I have checkboxes save their values for a logged in user? My Wordpress website features various checklists in a table format. When a user finishes a task on the list, they would be able ...
0 votes
1 answer
29 views

Woocommerce template file outputting <strong><code> tags

I'm struggling with the editing of the woocommerce template files. In particular, I'm trying to create a custom cart page and, as guidelines, I've copied the cart.php template file to my template ...
0 votes
1 answer
165 views

Reorder a page of posts of a certain taxonomy/value by a custom field

I want to re-order a page of posts of a certain taxonomy/value by an added Advanced Custom Fields PRO field, instead of the default (ordered by post-date). We have a WP site with a custom taxonomy, ...
0 votes
1 answer
52 views

remove edit link only for published post and pending post

Currently i m using this shorocdes add_filter( 'post_row_actions', 'remove_row_actions', 10, 1 ); function remove_row_actions( $actions ) { if( get_post_type() === 'post' ) unset( $actions['edit']...
0 votes
1 answer
79 views

Copying and pasting to Wordpress "code editor" code via the front end and clipboard

I'm trying to emulate what these folks do with their "Copy code" button: https://gutenberghub.com/templates/team-56 Their approach is great for copying to clipboard and pasting directly to ...
0 votes
1 answer
616 views

How to create a checkbox to show/hide a field in WooCommerce checkout [closed]

I want to put a checkbox before all fields where I want to ask people if they have vat number and when they check that checkbox I want to display vat_number field, also when isn't checked I want to ...
1 vote
1 answer
719 views

Wordpress wp_insert_post() returns 0 but not not wp_error

wp_insert_post() return value says: (int|WP_Error) The post ID on success. The value 0 or WP_Error on failure. Okay, I' have an import routine running and all but a few (about 20) of them import ...
0 votes
1 answer
89 views

how to display google maps with javascript

I want to display one google custom map with javascript, I set this code in a code module, but when I post it only appear the code and not the map, how can I display my map correctly? The code works ...

1
2 3 4 5
7