Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options not deleted user 74311

Custom Post Types extend WordPress to support additional content.

0 votes
Accepted

Pre-selecting the category for a custom post type

in my exemple, "CPT" stands for the slug of your custom post type. First step : Using the link of "create new CPT" to add the information of category. for exemple the result would look like http://s …
mmm's user avatar
  • 3,795
1 vote

Change post type depending on shortcode

the callback function has 3 parameters and the 3rd is the tag name : add_shortcode( 'all_faq', 'commonFunction' ); add_shortcode( 'wordpress_faq', 'commonFunction' ); function commonFunction($attr …
mmm's user avatar
  • 3,795
0 votes

Sorting Custom Post Type by Meta Value but wont display when set to 0

try this to do a double sort. on forum_order first and by title if forum_order values are the same $forum_category_query = new WP_Query( array( 'post_type' => 'forums', 'meta_ke …
mmm's user avatar
  • 3,795
0 votes

Automatically Add a default category to a Custom Post Type before save_post action

the hooks "save_post..." are called too when a new post is created then you can set default values with that $customPostType = "customTypeCode"; add_action("save_post_$customPostType", function ($p …
mmm's user avatar
  • 3,795
1 vote

bulk Update post_meta with default values

You can add a new bulk action for posts with this code : $postType = "post"; add_filter("bulk_actions-edit-" . $postType, function ($actions) { $actions["specialSave"] = "Special save"; …
mmm's user avatar
  • 3,795
3 votes
Accepted

Remove custom permalink structure from custom post type without modifying register_post_type...

you can do this to modify the definition $args = get_post_type_object("glossary"); $args->rewrite = array("with_front" => FALSE); register_post_type($args->name, $args); this has to be done after …
mmm's user avatar
  • 3,795
3 votes
Accepted

DIsplaying URL of custom field in last post of certain taxonomy && post type

numberposts doesn't exist for WP_Query instead use "posts_per_page" => 1
mmm's user avatar
  • 3,795
0 votes

Making my custom column sortable

in the action request, the keys meta_key and orderby already exists then try to overwrite like this : if ( isset( $vars['orderby'] ) && 'count' == $vars['orderby'] ) { $vars["meta_key"] = "coun …
mmm's user avatar
  • 3,795
2 votes

Rest Api v2 orderby meta_key in custom post type

You can use this filter to change order : $type = "cptCode"; add_filter("rest_" . $type . "_query", function ($args, $query) { $args["orderby"] = "meta_value"; $args["meta_key"] = "my_meta …
mmm's user avatar
  • 3,795
1 vote
Accepted

Dynamic assign a custom template to custom post type posts

locate_template search template only in themes then to use a file outside themes, you can use the filter template_include like that add_filter("template_include", function ($template) { $post = …
mmm's user avatar
  • 3,795
0 votes
Accepted

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

You can do something on a post creation with the action save_post_... $customPostType = "custom"; add_action("save_post_" . $customPostType, function ($post_ID, \WP_Post $post, $update) { if ( …
mmm's user avatar
  • 3,795
3 votes
Accepted

Can't unregister parent theme's CPT from my child theme

you cannot remove a hook when you are in the same hook with the same priority. a solution is to hook the action with a lower priority add_action('init', 'remove_cpt', 5);
mmm's user avatar
  • 3,795
1 vote
Accepted

Automatically update custom field in all posts of a custom post type

the third argument of wp_schedule_event is a action to call : https://codex.wordpress.org/Function_Reference/wp_schedule_event then you need to hook the fonction at the action like this : add_actio …
mmm's user avatar
  • 3,795
6 votes
Accepted

Change slug of registered custom post type in child theme

with your code you completely redefine your CPT instead of just modifying the slug maybe this change the public access try this : $args = get_post_type_object("portfolio"); $args->rewrite["slug"] = …
mmm's user avatar
  • 3,795
0 votes

Creating alternate meta box context locations

these metaboxes appears as normal because add_meta_box() adds them in the loop of the others metaboxes. and to use a real metaboxe fully functional (in order to hide / show it and move it arround the …
mmm's user avatar
  • 3,795

15 30 50 per page