Skip to main content

Questions tagged [codex]

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

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

register_rest_route, Compare purchase codes and send a response

I have a question, I would be grateful if someone could help me I am working on WordPress plugins, I have 2 files, the first file is Verification which is for users and the second file is the ...
pooyan golkar's user avatar
0 votes
1 answer
48 views

How to use filter in this situation, can not modify the structure using filter

plugins/idx-broker-platinum/idx/shortcodes/register-impress-shortcodes.php This is the plugin file where I need to use a filter to override the structure. Filter name: impress_showcase_property_html ...
Ravi's user avatar
  • 247
0 votes
1 answer
61 views

What is the reason to use function strings for callbacks

Throughout the WordPress documentation I see callbacks being inserted as strings instead of function variables or closures. Let me examplify that; function wpdocs_my_save_posts( $post_ID, $post, $...
th00ht's user avatar
  • 145
0 votes
1 answer
77 views

Next/Previous Url only

I only want to get the URL of the next/previous post link instead of title+link. I searched WP's codex but unfortunately, I couldn't find it. Any ideas?
Jornes's user avatar
  • 753
0 votes
1 answer
44 views

get_page_by_title() doesn't return the post object if the title has inverted comma (')

The question is self-explanatory. I have tried these so far. I have a post named John's Test with post id 1. In single.php, I tried, $extraPostID = 1; $extraContent = get_page_by_title(get_the_title($...
Sahriar Saikat's user avatar
2 votes
1 answer
74 views

*Just curious* I erroneously used hook add_action() instead of add_filter() and there was no error and the result was correct. Why is that?

While working on a project I used the incorrect hook type add_action() which does not exist, yet there was no error notice and the correct result returned. I only realized it was wrong while searching ...
Nadal's user avatar
  • 89
0 votes
0 answers
40 views

Using Json Schema with wordpress codex

I have a json schema code that I need to use it for all posts <script type="application/ld+json"> { "@context": "https://schema.org", "@type": "...
akhbarejadid's user avatar
0 votes
1 answer
240 views

How do I define and register a shortcode function in a namespaced functions.php file?

I wrote a function in my theme's functions.php and am attempting to register it with add_shortcode() as shown in the Codex: <?php /** * theme's functions.php */ namespace MyNamespace; //[foobar]...
Jacob Ford's user avatar
1 vote
0 answers
80 views

Multiple Images/ Slider with custom post [single.php] [closed]

I am looking for a approach to add multiple images option under the Feature image section in wordPress custom post type. I will integrate/implement these images on single.php file where I want to show ...
Nayla Akrati's user avatar
0 votes
0 answers
36 views

adding category and tags to admin plugins menu

How to create a tag and category for plugins just like the function shown below performs for pages? function add_categories_to_pages() { register_taxonomy_for_object_type( 'category', 'page' ); } ...
James's user avatar
  • 1
0 votes
1 answer
316 views

What are the available options for "Name" in WP search?

I am trying to find the list of available values for name in the search to filter results. So far I have found name="s" is the default name="cat" is for categories and name="post_type" is for post ...
Iisrael's user avatar
  • 135
0 votes
1 answer
61 views

how do i add customizer edit option without plugin in wp

when i go to wp customizer then i want edit the name popular and cat_id =21 <div class="p_list"><h2><span>popular</span></h2> <?php $first = true; ?> <?...
abdullahsk's user avatar
1 vote
1 answer
41 views

Wordpress Codex has different number of arguments for get_previous_post and get_next_post functions. Why?

Compare the following two links: https://codex.wordpress.org/Function_Reference/get_next_post https://codex.wordpress.org/Function_Reference/get_previous_post The get_previous_post function doesn't ...
Paul Crosby's user avatar
0 votes
2 answers
1k views

WP_Query for custom post type and category_id not working

I am tring to implement custom filter for The Event Calendar. I have used this code $args = array( 'post_type' => 'tribe_events', 'meta_key' => '_EventStartDate', 'meta_query' => ...
Sudhir's user avatar
  • 113
0 votes
1 answer
211 views

How to disable Wp-Page Navigation on Blank Search in Wordpress

Im using the Following Code in search.php <?php if (have_posts() && strlen( trim(get_search_query()) ) != 0 ) : while (have_posts()) : the_post(); ?> <?php endwhile; else:?> <...
Rajesh Patel's user avatar
2 votes
1 answer
603 views

Wordpress codex: apply_filters - clarification on creating a new hook on the fly. How do we use it?

I have read the WordPress Codex on add_filter and apply_filter countless times, but it wasn't until reading woocommerce source code today that something clicked in the way that maybe I don't ...
kruddock's user avatar
0 votes
1 answer
659 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 ...
Brittany Layne Rapheal's user avatar
1 vote
1 answer
75 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 ...
Nimesh's user avatar
  • 441
0 votes
1 answer
160 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 ...
Caesar's user avatar
  • 25
0 votes
1 answer
215 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') ...
WordCent's user avatar
  • 1,877
0 votes
1 answer
118 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
T.Todua's user avatar
  • 5,810
0 votes
1 answer
2k 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, ...
CodingHero's user avatar
0 votes
1 answer
373 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://..........
WordCent's user avatar
  • 1,877
1 vote
2 answers
2k 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 ?&...
WordCent's user avatar
  • 1,877
0 votes
1 answer
1k 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=...
sevoug's user avatar
  • 21
1 vote
1 answer
680 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', ...
David Cring's user avatar
0 votes
1 answer
61 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 ...
Check Hook Fighting's user avatar
0 votes
3 answers
751 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 ...
3000's user avatar
  • 185
1 vote
2 answers
35 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 ...
Sarah's user avatar
  • 11
5 votes
1 answer
701 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 ...
Makiomar's user avatar
  • 151
1 vote
1 answer
313 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). $...
DSX's user avatar
  • 113
1 vote
1 answer
1k 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 ...
Mohamed Omar's user avatar
3 votes
1 answer
320 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 ...
Ken's user avatar
  • 133
0 votes
1 answer
962 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=...
johan riyanto's user avatar
1 vote
2 answers
2k 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( ...
Malisa's user avatar
  • 589
17 votes
2 answers
49k 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: /* ...
Django Reinhardt's user avatar
0 votes
1 answer
91 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 ...
tmgale12's user avatar
3 votes
1 answer
291 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 ...
Sophia_ES's user avatar
  • 155
1 vote
2 answers
2k 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, ...
KDX's user avatar
  • 183
1 vote
1 answer
2k 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 ...
reg's user avatar
  • 11
9 votes
1 answer
500 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 ...
Tim Malone's user avatar
  • 4,754
-1 votes
1 answer
44 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 ...
Larry Lawless's user avatar
1 vote
1 answer
11k 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 ...
Stephen's user avatar
  • 1,304
0 votes
2 answers
90 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?
Toskan's user avatar
  • 524
0 votes
0 answers
137 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 ...
Danryl Tigol Carpio's user avatar
1 vote
2 answers
1k 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 ...
Shovan's user avatar
  • 21
1 vote
0 answers
167 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?
Jonny's user avatar
  • 145
0 votes
1 answer
104 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 ...
コードバ リノ's user avatar
1 vote
2 answers
509 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'...
johnkilla's user avatar
0 votes
1 answer
296 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 ...
Chris's user avatar
  • 1