Articles of customization

Backup the Database and Restore from the Backup?

I am using WordPress 3 and would like to backup the database to my computer (a Mac). My webhost is using PHP safe mode, so that sometimes limits what plugins I can use. What is a good way to do a database backup? Is it possible to be automated? Are incremental backups recommended/easy? Obviously I […]

get_pages() not ordering as it should

I’m using get_pages() function to get all subpages from a page like this: $childrens = get_pages(array(‘child_of’ => 7, ‘sort_column’ => ‘post_date’, ‘sort_order’ => ‘DESC’, ‘depth’ => -1)); This is supossed to get me a list of all pages (no matter if direct children, children of children, etc) orderen by the date they were created, but […]

How to hide or remove unwanted widgets on Multisite installation?

I am using Multi-site installation. I don’t want all the widgets appear under widgets.php on dashboard .So I tried to find a way to remove or hide unnecessary widgets . SO that the new sub-sites under my Multi-site created won’t have much widgets. So the users don’t get confuse with lot of widgets . I […]

When adding a custom REST endpoint, where do you put the endpoint function, and where do you put the function registration call?

WordPress documentation, bloggers, and StackExchange answerers have done a great job of describing the code you write to make a custom REST endpoint, but I cannot find any documentation that describes exactly WHERE you place the code. Say I have an endpoint that I want to return the string “foo”. From my reading, I implement […]

Post/Page Preview Template

Is there a way to have a custom template php file that is only used for previews instead of it using the single.php file? This way the user knows they are in preview mode?

WordPress Paginate $wpdb->get_results

Due to a complex multisite config, I have a query which combines the posts from two blogs and I would like to paginate the results. I am grateful for any help. I have posted my query. $latestposts = $wpdb->get_results( ” (SELECT * FROM net_5_posts INNER JOIN net_5_term_relationships ON net_5_posts.ID=net_5_term_relationships.object_id WHERE post_type = ‘post’ AND post_status […]

Custom Post Types on Category Pages

I’m working with a custom post type that uses the normal WordPress categories. I am able to modify my category template to display my custom post types exactly how I want them. The problem is, once I do this, normal blog posts are also affected. Of course I can limit either normal blog posts or […]

Removing Metabox for “Slug” without removing functionality

Here is an interesting question. I have recently noticed that if you utilize the code remove_meta_box(‘slugdiv’, ‘post’, ‘normal’); you are actually unable to modify the slug when you click on the url slug under the page title. To clarify, when you use remove_meta_box for the slugdiv, the metabox and the screen options get removed however […]

How to remove comment section from page only , not from posts pages?

How to remove comment section from page only , not from posts pages?

WordPress hook before inserting post into database

I need to do check the inserted post for certain keywords and perform some functions depending on the keywords found. is there a wordpress hook that executes “just before the post is inserted into the database” ? Or will i have to modify wordpress core ? Also, i will need to prevent the post from […]