If this code is in functions.php or directly in plugin code, the for loop at the top will run every time WordPress is loaded, and the hook at the end refers to a function which doesn’t exist.
So probably what you want is to put the top code in a function:
function zed93_create_new_page {
for ($i = 0; $i < count($namepages); $i++) {
mic_create_new_page($name[$i],$namepages[$i]);
}
}
And correct your hook to:
register_activation_hook(__FILE__, 'zed93_create_new_page');
Note the function name can be anything, but making it unique to your project helps avoid collisions with other plugins / themes.
Related Posts:
- How do I check if I linked to a post before I delete it?
- How to check if post meta key exists or not in wordpress database
- Custom Post Types, slug, archive and SEO plugins
- Portable Post Links
- Related Posts by Multiple Tags?
- Dynamically update post title in admin page
- How can I display 7 posts on the home page, but 9 posts on the subsequent pages?
- WP REST API, query total posts in a category
- duplicate posts when trying to update a post using the wp_insert_post.
- Add custom field to all posts in specific category
- 404 error after publishing a post
- How to remove_filter that filters iframes in posts? [duplicate]
- How can I group posts by date on frontpage?
- Text after more tag in posts
- Hide parts of the post content on the home page
- Hide comments awaiting moderation from user who submitted the comments
- Get the post_id of a new post
- How to add custom content (text/image) at start of content (IN content ie the same line)
- Prevent post from being published if no category selected
- How to display sorted posts in the ‘All Posts’ page
- WordPress blog posts api – get posts by author
- Get post excerpt and title by specific post ID?
- Load content in a div with ajax
- Get a custom field of all posts on current blog page
- Will removing tags move Posts to Trash?
- Direct link to “New post” in specific category?
- JSON – Permission Error?
- Is it possible to change post id for an already added menu item in WordPress?
- WP Bakery Load More Button loads the same posts
- How do I retrieve then print the currently viewed sub categories?
- WP Query – Posts Per Page not working in combination with category__in
- Apply a style for 4 blogs and another style for the next 4 blogs in wordpress blog page?
- How to convert contact form 7 submission to post after submission? [closed]
- How to render taxonomy in loop of custom post_type
- Posting blog entries in screenplay format
- Listing Specific Categories from Current Post with Depth
- Custom Post Type Rewrite To Include Parent Page(s)
- get_the_category listing in hierarchial order
- How to automate featured posts number? [duplicate]
- Getting only the URL of the post thumbnail
- outputting posts’ taxonomies: cant get ‘get_the_taxonomies’ working
- Linking to pages/posts within the site
- Displaying posts that belong to a specific author
- Importing posts only – consequences?
- Add Post As a menu Item
- Query for first 3 posts to change the look and feel
- Getting blog pagination to work on page set as front page
- Navigate through the posts using keyboard arrows
- unique post in “$args” of wp_query display more than one post
- New Posts and Pages Won’t Save
- Why excerpt is Displaying same in Random Posts list
- Is there a way getting post fields using `transition_post_status`
- How can I add 2 buttons with shortcode
- Show posts on front page only
- Get featured image on hover of post title [closed]
- How get top post view for today for today post
- Changing wp_link_pages() to “Next Page” and “Previous Page” buttons?
- Why my meta boxes won’t show in front post page?
- Authors’ Links on Homepage Not Going to Author Post Pages
- My post does not show up
- Set Default Post as Parent Child (Nested) Relation
- Display Current Posts Category (with the most posts)?
- How can I add random alphabets in wordpress permalink posts structure
- Create a List of Widgets, where each widget holds three attributes
- How to automate creating pages on a hosted wordpress from a local set of folders?
- Filter posts by month (dropdown)
- How to fetch courses in all languages in WordPress?
- Redirect old Posts URL to new URL
- Create a tree with categories with get_posts()
- Display simple html code in post
- How to display particular set of wordpress post on a webpage?
- Center crop the feature image
- Allow users to post their videos to my wordpress website?
- Display Custom Post Category Count & WordPress Category Count Using Shortcode
- Add Categories To Custom Post
- Display post on main page with thumbnail
- Display Posts by Categories
- How can I alternate styling of images in a post? [closed]
- Custom Single Post Type not referring to single-post-type.php File
- Display iframe or embeded posts on homepage
- Custom template for different post types
- index.php is only displaying current month’s posts?
- How can I use the “Your latest posts” as a template?
- Query to get data of a post, if in category?
- Order posts by custom field
- prevent same wordpress post title
- Remove duplicated posts in the loop if post has more than one category
- “Current” class on a singular page menu item with custom post types?
- get next/previous post name
- Add class name of content, Hypernate doesn’t work to IE and Chrome
- Get image paths from RSS feeds
- How do I display the next 3 posts in the sidebar?
- 2 tick boxes appearing below comments
- How can to use the players from the Media Widgets in the body of a post to play audio and video files
- Issue with wordpress pagination: last 2 posts show again on second page
- Extra Theme – Fit image inside of Featured Post Slider
- Polylang – display one post into 3 categories with different lang [closed]
- How can I show the positive and negative comments for a same post separately?
- Dynamic Menu Item
- Adding contents to my wordpress site