wordpress tips


Know basic wordpress!!


19 User See All
milind gohelNAGA SAI HEMANTH JAMILIVishal PatelArpan PatelAnsari Md Tahir
Goti RahulAdminShaily ShahNitesh ParmarParmar Dharmesh
Dev SharmaSaraswati KallaVivek PatelJigar ParikhMohit Dave
Chirag NakumMehul SankadasariyaRahul KashaudhanJoydip Panchal
Photo
Back to cluster list

Make Comments..!!


Joydip Panchal
Issue : Permalink to custom post type gives me 404 error.

If you have added custom post type and if it display 404 page not found error.

To solve this follow these steps :
1. Login into your wordpress admin
2. Go to Settings -> Permalinks
3. Update Permalink Settings.
4. It's Done
Like · Comment ·
Arpan Patel
Suggest me plugin to change Wordpress admin design.
Like · Comment ·
Admin
wp_insert_post( $post, $wp_error );

This function inserts posts,pages or your custom post type in the database.

This function's first parameter is $post, which type is array. You must set this parameter. This array has many keys, merely you can omit to put in default values. Keys are listed below :

'ID' => If you set this value, that doesn't mean it will create a post with that ID number. But it will update the post with that ID number with the other values specified in this array.
So if you want to insert a new post, this key must be blank or not set.

'post_content' => The content of the post

'post_name' => The name(slug) for your post

'post_title' => The title of your post.

'post_status' => Set this key to your need. Default value is 'Draft'

'post_type' => This key set the value for your post. Default value is 'post'

'post_author' => The user ID number of the author. Default is the current user ID.

'post_parent' => Sets the parent of the new post if any. Default 0.

This keys are main keys.
Other keys which rarely used are : 'menu_order', 'to_ping', 'pinged', 'post_password', 'guid', 'post_content_filtered', 'post_excerpt', 'post_date', 'post_date_gmt', 'comment_status', 'post_category', 'tags_input', 'tax_input', 'page_template'.

Some important notes which you have to remember are :

1. If you set a post_status of 'future' you must specify the post_date in order for WordPress to know when to publish your post.

This function's second parameter is $wp_error. This is optional parameter. This will allow return of WP_Error object on failure if it is set to true.

Example :

// Create post object
$example_post = array(
'post_title' => 'Test post',
'post_content' => 'This is test post.',
'post_status' => 'publish',
'post_author' => 1
);

// Insert the post into the database
wp_insert_post( $example_post );
Like · Comment ·
Ansari Md Tahir and 2 other like this
Joydip Panchal
Wordpress Themes : http://yithemes.com/
Like · Comment ·
Amit Dubey and Er Chandresh Prajapati like this
Joydip Panchal
What is hook??

Hooks are the backbone of WordPress. They enable plugin developers to “ hook ” into
the WordPress workfl ow to change how it works without directly modifying the core
code. This enables users to easily upgrade to newer versions of WordPress without losing
modifi cations.

List of all hooks : http://adambrown.info/p/wp_hooks/hook
Like · Comment ·
Download Android App