Stack Exchange Network

Stack Exchange network consists of 174 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 [codex]

Online manual for WordPress and a repository for WordPress information and documentation.

0
votes
0answers
11 views

my function works if call it but not as activation register hook

hi there I have a function which makes some row in a table, If i call it it works normally, but if I use as register_activation_hook(__FILE__,'add_sellers_brand_size_to_db'); it doesn't work, code is ...
0
votes
0answers
28 views

Custom search in Wordpress

So i have searched almost everywhere and tried at least a dozen different ways to accomplish a custom wp search. Hopefully i can verbalize what im trying to do well..here goes. I have a content page -...
0
votes
1answer
52 views

Excluding category from post navigation in Wordpress?

I'm looking to exclude a category from the post navigation. Originally, I looked up manipulating <?php the_post_navigation(); ?> to exclude categories, but a few posts I read (like this) pointed ...
1
vote
1answer
36 views

Logic to Print/echo a css class only for 1st post and ignore all post after 1st? [closed]

I am trying to get a function to get three posts and print/echo 1st post with class active and rest of the post will be Normal. I tried this code in functions.php to generate and didn't achieve the ...
0
votes
1answer
33 views

Function for when new custom post type is created should do something

I've been searching in the codex from wordpress and search through google but didn't find any function or any code that can help me. I want to build a conditional that when there is a new custom post ...
0
votes
1answer
42 views

REQUIRED: get_bloginfo('template_url') was found in the file search.php. Use get_template_directory_uri() instead

Theme Check error → REQUIRED: get_bloginfo('template_url') was found in the file search.php. Use get_template_directory_uri() instead. Line 21: <img src='<?php echo get_bloginfo('template_url') ...
0
votes
1answer
29 views

Difference between `is_serialized_string` and `is_serialized`

I have read the codex, but it is not quite clear to me: what's difference between is_serialized and is_serialized_string and
-1
votes
1answer
531 views

Wp Super Cache - Function to reset cache of a specific page

I looked for a solutin like more than hour, but not chance. There is a function to reset cache of a specific page manually? I'm using wp super cache. I'm updating some posts meta values using API, ...
0
votes
1answer
28 views

the_tags : can we insert a class

<?php the_tags( '<ul><li>', '</li><li>', '</li></ul>' ); ?> when we use the above we get this kind of HTML → <ul> <li><a href="http://..........
0
votes
2answers
700 views

Get the category name outside of the loop in category.php

I am in a category.php, and I have to write the category name outside of the Loop. The category name needs to be pulled dynamically through PHP. <p>You are browsing <?php get_the_category ?&...
0
votes
1answer
451 views

Remove Theme menu link from Admin Panel

I am trying to remove menu from the admin panel my code works as it removes some pages but i can't remove the following. admin.php?page=ot-theme-options admin.php?page=ot-settings admin.php?page=...
1
vote
1answer
139 views

How to slice an array using posts_per_page? [closed]

The below code shows all the images of wp gallery with all its sizes but it not like that what i want. function get_images_high_data() { $args = array( 'post_type' => 'attachment', ...
0
votes
1answer
35 views

Re-coding category-template.php to go to custom URL

Thanks for the support everyone – love these forums! Here is the issue: – category and tag pages being automatically created aren’t fully customizable compared to normal pages. – solution was ...
0
votes
3answers
240 views

Redirect users not logged in to the standard login page (and back) from some posts and pages

I'm looking for a hand-coded solution to do the following: in some pages (so, not every page) I want to redirect the users NOT logged in to the standard login page: when they login, they are ...
1
vote
2answers
26 views

I want to remove the home page header image from all other pages

I want to remove the home page header image from all other pages. When you click an individual article, the feature image and header image blend into each other in an unflattering way.There needs to ...
5
votes
1answer
99 views

What does the raw value for the get_bloginfo's filter argument exactly do?

The $filter argument for the get_bloginfo function has a default value of raw but WordPress' Code Reference didn't mention another allowed values. What this raw stands for and what are other possible ...
1
vote
1answer
97 views

download_url() appears as grey icons

I try to download pictures from url from different website with the command download_url($url, $timeout) to get it in the media library. And after, I make a wp_handle_sideload($file, $overrides). $...
0
votes
0answers
171 views

How to include sub domains in WordPress search without using a plugin?

I am trying extend my search functionality to multiple sub domains. For example, if I am trying to search on alpha.com, then I am trying to also include results from "abc.alpha.com", "xyz.alpha.com" , ...
1
vote
1answer
219 views

How to use WP_Term with (menu) argument in the wp_nav_menu?

I am trying to understand the wp_nav_menufunction and i am okay with its arguments but wordpress states to use int , string and WP_Term with the menu key. I need to know how to use the WP_Term with it ...
1
vote
1answer
164 views

Are we allowed to use the Allman (BSD) indent style when coding WordPress plugins and themes?

I am a real fan of the Allman (BSD) coding indent style. However, when i review the top rated plugins on WordPress, i am finding them using the K&R coding indent style. Is there a requirement ...
0
votes
1answer
395 views

Remove Url Parameter Wordpress

I have problem with search in WordPress. I want to remove the "s" parameter in the URL. This is my URL: www.example.com?post_type=tour&s=&tour_location=70&tour_types=116&tour_month=...
1
vote
2answers
338 views

When to use an if statement after get_posts?

Whilst looking through the codex for the get_posts function, I noticed that in the majority of the examples they do not show an if statement after call to get_posts Example: <?php $args = array( ...
10
votes
2answers
14k views

What does is_page_template() compare against?

Looking through the Wordpress documentation, it says that is_page_template() compares against a "template name", if one is provided. I have a template stored in page-homepage.php called Homepage: /* ...
0
votes
1answer
24 views

if is specific custom post in cpt

I need to be able to target a specific post in a CPT. According to the codex I can use the following code to reference a specific custom post type; `if( is_singular ('cpt-name') { //Something here ...
3
votes
1answer
278 views

Authoritative answer on which boots first - Plugins or Themes?

I can't seem to find anywhere in the WordPress documentation an authoritative answer on the question on whether a WordPress plugin boots first or whether a WordPress theme boots first. I need to know ...
1
vote
2answers
713 views

How to use Internationalized human_time_diff() function in Chinese?

Looking at https://codex.wordpress.org/Function_Reference/human_time_diff I'm using an English version of Wordpress. In my theme template, I would like to define custom text of min, hour, day, week, ...
1
vote
1answer
1k views

Wordpress is adding margins and padding to my custom menu?

I've installed wordpress on my computer so I can learn how to make custom themes and test them locally. Currently I'm playing around with some pre-made code from a tutorial so I can get more familiar ...
9
votes
1answer
406 views

Is the codex no longer actively maintained?

I generally Google when I need a quick reference for a Wordpress function, and generally it's a Codex post that comes up first (eg. https://codex.wordpress.org/Function_Reference/get_term when ...
-1
votes
1answer
41 views

Misleading information in the Codex, how do they get away with it? [closed]

I'm new to WordPress Development but I've programmed in PHP for a couple of years. My understanding is that the Codex pages are as close to authoritative information on WordPress that you're going to ...
0
votes
1answer
5k views

Changing next and previous post link text

So I've been staring at the CodeX for about 10 minutes and can still not figure how to do this next and previous on a the post page. So I've added <?php next_post_link(); ?> and <?php ...
0
votes
2answers
62 views

get_month_link uses what wordpress template?

I tried using archive.php and category.php but always index.php is used of my template. How can I customize what template file is used?
0
votes
0answers
40 views

wp_schedule_event need to deactivate plugin changing recurrance

I currently developing a plug that has wp_schedule_event , the purpose of wp_schedule_event to my plugin is i want my plugin so send an email depends on recurrance of the wp_schedule_event. I also ...
0
votes
1answer
694 views

Wordpress from url get external source title

Hi I am building a news website. I am trying to automate it. News url (metabox) Title Content area Image (featured image option on wordpress) When paste the site url I would like the other metabox ...
1
vote
0answers
138 views

WordPress Codex or equivlent for Kindle use?

Is there a mobi/epub version of the Codex that I can use with an e-reader?
0
votes
1answer
72 views

Can't put a hyperlink on Featured Post's Image

For the life of me I can't get a clean answer to my issue. The codex says to use get thumbnail but whenever I exchange the current code for the get thumbnail everything just stops working. I'm fairly ...
1
vote
1answer
131 views

How to add a zero before numbers in WordPress Post Pagination?

I want my POST pagination to show the numbers from 1 to 9 like this: 01 02 03 04 05 06 07 08 09 10 11... and NOT like > 1, 2, 3, 4... Actualy i have this code: <?php wp_link_pages( array( 'before'...
0
votes
1answer
131 views

Cleanup orphaned wp_terms and wp_term_taxonomy

As a non-tech guy and not familiar with Wordpress Codex, would appreciate any guidance on providing the codex for: cleaning of orphaned wp_terms cleaning of orphaned wp_terms_taxonomy cleaning of ...
6
votes
1answer
249 views

Why is the use of @uses tag in docblocks discouraged?

See inline documentation standards Note: This tag has been used in the past, but should no longer be used. What gives? I am building a plugin to build a codex from the source of a plugin/theme ...
0
votes
1answer
24 views

Rewriting to a different page based on existence of query string?

I have a home page (id = 4) and a form page (id = 5). I want to send them back to the home page if they don't have a query string. But if they do have the query string we are looking for, then I want ...
0
votes
1answer
8k views

Programatically added attribute, set to 'show on product page' automatically. Woocommerce [closed]

Ive written a script to import products to a new install of Woocommerce. The products have attributes set up in the admin. This bit of code adds the attributes on import. update_post_meta($...
13
votes
3answers
21k views

Upload Multiple Files With media_handle_upload

I have a WordPress form plugin and I use media_handle_upload to upload the files and get there ids directly and attached its ids to the post as a meta date, I used the following to did that: The HTML ...
0
votes
0answers
59 views

Does a codex exist for creating meta boxes in taxonomy

I am looking for WordPress official documentation to create meta boxes in a taxonomy. There are many tutorials, but each of them is completely different. I don't want to use any plugins. I need the ...
8
votes
1answer
16k views

Issues enqueueing parent & child theme stylesheets with revised Codex method

This post brings up a few questions I've encountered pertaining to the recent changes around stylesheet enqueueing methods brought up in this thread and this thread. The issues I encountered came up ...
0
votes
1answer
45 views

Questions on WordPress Codex Concept

When I was reading the WordPress Codex about outputting the Post and Pages I saw these two Titles at Here Output a list of all registered post types and Output a list of all public custom post ...
0
votes
3answers
1k views

wp_get_attachment_image_src always returns false

I'm using wp_get_attachment_image_src to retrieve image URL. Codex is simple for this function and starting from an ID on my database I used wp_get_attachment_image_src in this way: $image_url = ...
2
votes
1answer
3k views

Override Constants in Child theme

I have a parent theme that declare these constant in function.php: define("THEME_DIR", get_template_directory()); define("THEME_DIR_URI", get_template_directory_uri()); define("THEME_NAME", "BARNELLI"...
0
votes
1answer
659 views

How to change templates based on URL

Okay, so here's what I'm trying to do but having a hell of a time figuring out. I've got a website that uses the MemberPress plugin. All of those pages by default use the standard default template ...
0
votes
2answers
526 views

post_class not working with css

through the codex I read about how to use the post_class() function to create a css hook for styling the content. Here is the code I have, PHP: <li class="<?php post_class();?>"> <?...
0
votes
1answer
43 views

using add_action without having custom plugin or theme

I need to send an email after an author publishes or updates a post. But I don't like developing custom plugin or theme. Is there any plugin that runs a php script after publish. Or where can I insert ...
0
votes
1answer
133 views

Block wordpress style for my plugin admin page

I have my own style for my plugin, it works, but wordpress adds a style too, and the page is not looking very ok. Is there any way to block wordpress style for my plugin administration page?